Wicket: Source to Eclipse Using Maven 2

by Tim O'Brien

Wicket graduated from the incubator, or so I've heard. I'm never 100% sure of what has or has not graduated. Anyway, unlike a number of widely used open source libraries, Wicket is easy to checkout from source, compile, install, and have running up in Eclipse because it happens to use Maven 2 as a build system. In other words, you don't have to fish around for instructions on running some byzantine Ant build, it's all summed up by the following commands:


  • svn co http://svn.apache.org/repos/asf/incubator/wicket/trunk wicket

  • cd wicket

  • mvn install eclipse:eclipse

  • (start eclipse...)

  • (File -> Import -> Existing Projects into Workspace) *don't click copy, leave 'em where they are

  • (configure your M2_REPO classpath variable to point to your local repository)



Done - took you maybe 5 minutes start to finish...

And, that's the way it should be. No need to read some readme file to try to figure out what software needed to be installed, or what other projects need to be in what relative directories, etc...

maven 2 just works.

Update 9:09 PM: Thanks to Mr. Locke for correctly pointing out that I left out the import projects step in the comments.

20 Comments

Jonathan Locke
2007-07-21 18:44:48
You left out the final import projects step in Eclipse. One tiny hint for mac users there. Do not EVER check that box that says "copy projects into workspace"! Eclipse will set your file attributes wrong and everything will go haywire. Just import the projects in place without copying them and you'll be fine.
Eelco Hillenius
2007-07-21 19:18:09
Yep, Wicket graduated. We hope to make a little bit more noise when we actually get the top level domain working.


An alternative way to get your project started when you're using Maven 2 is to include this in your pom:


<dependency>
 <groupId>org.apache.wicket</groupId>
 <artifactId>wicket</artifactId>
 <version>1.3.0-beta2</version>
 <type>jar</type>
</dependency>


or if you want to work with daily snapshots:


<repositories>
 <repository>
  <id>wicket-stuff.org</id>
  <url>http://wicketstuff.org/maven/repository/</url>
  <snapshots>
    <enabled>true</enabled>
  </snapshots>
 </repository>
</repositories>


<dependencies>
 <dependency>
  <groupId>org.apache.wicket</groupId>
  <artifactId>wicket</artifactId>
  <version>1.3.0-SNAPSHOT</version>
  <type>jar</type>
 </dependency>
...


and then again use mvn eclipse:eclipse. It will also install the source jars.

Dean
2007-07-22 00:23:06
I've tried to checkout and compile many open source projects that use maven 2 as their build system. I can honestly say that not once have I been able to just build something after a clean checkout by doing mvn install. Normally getting a build involves pom-hacking or manually installing jars into your local repo. What's so hard about ant -projecthelp anyway?
bhaskar
2007-07-22 07:16:24
Or if you use netbeans with the maven plugin, just check out wicket source code from within netbeans, that's it you are done.
Seriously the maven support in netbeans so much better than eclipse. Any folder that has a pom.xml is automatically recognized as a maven project.
No need for mvn eclipse:eclipse , no need for .classpath and .project, and no need for M2_REPO..:-)
Nap Ramirez
2007-07-22 08:02:00
This new Maven2 plugin for eclipse would be useful:


http://code.google.com/p/q4e/wiki/Installation


With this, I think you'll never use the commandline again. ;)

Tim O'Brien
2007-07-22 11:47:08
@Dean, which projects. I've tried download and compiling both Hibernate and Spring lately. I ran into a few problems, but they had more to do with a proejct's half migration to Maven.


Take Spring for example, I can download the sources for Spring Batch and get up and running with the source in about 5 minutes. Spring Framework is another matter entirely, from what I see there's some sort of readme.txt file and a lib directory.


Anyway, Dean, I'd appreciate if you could call out those projects by name so I can go see what they are doing differently than Maven.


Eric
2007-07-23 06:23:30
If you have the most recent Eclipse Maven plugin (http://m2eclipse.codehaus.org/) and the most recent Maven Eclipse plugin (may still be in dev) but you can type: "mvn eclipse:m2eclipse" and it will configure your project for the Eclipse plugin... no more configuring Eclipse classpath - or re-running eclipse:eclipse when dependencies change.
Tim
2007-07-23 16:24:59
FWIW, if you want to build Wicket in NetBeans, it's very simple. NetBeans Maven support treats Maven projects as native NetBeans projects, just like the standard Ant-based ones:

  • Go to Tools | Plugin Manager (Update Center in 5.x), and download Maven support

  • (if you haven't already, check out the Wicket sources from subversion)

  • Go to File | Open Project, and simply open the wicket directory.

  • Press F11 to build

Luca
2007-07-23 23:27:39
For your information, you can have :


mvn idea:idea


generate all project/modules files for Intellij Idea (if you don't know, it's the source of all good things coming into NetBeans 6).


Also, latest builds of Idea 7 (www.intellij.net/eap, download selena) come with direct support to import maven projects (File|Import|Maven)


Have a good day

Luca
2007-07-24 01:25:04
Sorry, latest build (7087) changed things a bit in idea. Now the import is during creation of a new project.
Paul
2007-07-24 22:07:09
Would you recommend your book, Maven: A Developer's Notebook for anyone trying to use Maven in their own projects?
Tim O'Brien
2007-07-25 05:40:57
@Paul, no I wouldn't recommend Maven: A Developer's Notebook. It is very outdated. Instead of that book, go take a look at the online book at Sonatype http://www.sonatype.com
Dan
2007-07-26 17:12:11
One of the problems I have with Maven is that the repositories aren't up to date. The current version of Spring is 2.0.6, but the version in the repository is 2.0.2, with a datestamp from six months ago!
Dan
2007-07-26 17:44:57
Can anyone provide any hints on how you're supposed to keep dependencies up to date?


The latest Hibernate in the ibiblio repository is six months old.


If I do a svn checkout of the current Hibernate source and run mvn install on it, it won't even build because it craps out when it tries to connect to ibiblio to resolve the dependencies declared by Hibernate, because they don't exist there in the versions its expecting.


I feel like I'm trying to install RPMs again. http://www.sonatype.com/book/ has been no help.


Help?

Tim O'Brien
2007-07-27 07:06:58
@Dan, the Sonatype book is great..


spring: http://repo1.maven.org/maven2/org/springframework/spring/


hibernate: http://repo1.maven.org/maven2/org/hibernate/hibernate/


If you want a search function on the repository: http://www.mvnrepository.com

Martijn Dashorst
2007-08-05 16:45:44
The graduation was the actual establishing the project as part of the Apache Software Foundation. After that, the project needed to move all resources to the new location, and was depending on the help of the (excellent!) infrastructure team of ASF. This has been completed, and we are finally established as a TLP: http://wicket.apache.org


As such, you'll need to update the SVN repo url in your article:


svn co http://svn.apache.org/repos/asf/wicket/trunk wicket


If you already have a version checked out, you can switch it with the following command:


cd wicket
svn switch http://svn.apache.org/repos/asf/wicket/trunk


Alex
2007-08-08 08:30:07
Hi,


Some tests launched with mvn install fail with me:


org.apache.wicket.ajax.DomReadyOrderTest
org.apache.wicket.ajax.markup.html.componentMap.SimpleTestPanelTest
org.apache.wicket.ComponentTest
org.apache.wicket.markup.html.basic.SimplePageTest
org.apache.wicket.markup.html.header.inheritance.InheritanceHeadTest
org.apache.wicket.markup.html.header.testing.HeaderTest
org.apache.wicket.ajax.AjaxHeaderContributionTest
org.apache.wicket.ajax.AjaxRequestTargetTest
org.apache.wicket.ajax.markup.html.ajaxLink.AjaxLinkTest

Dave Feltenberger
2007-08-31 07:18:08
Timothy -


You can configure the M2_REPO variable automatically with the Eclipse plugin too, but using this command:
mvn -Declipse.workspace= eclipse:add-maven-repo


Cheers.


Dave

Tim O'Brien
2007-08-31 10:57:23
@Dave,


I know about using eclipse to add the M2_REPO classpath variable, but I almost never use it just from personal taste. OR maybe it is because it is just something I'm used to doing manually.

noob
2007-10-10 02:17:25
Why would one want to use the maven plugin?