This page describes the steps I follow to setup an Eclipse-based project for developing a new Wicket project. These steps are really just a detailed version of what you can find at: the Wicket quickstart page.
Create a Space
Begin by creating a source directory. For this example, I’ll create a directory called CheesrWorkspace (example project from the Wicket in Action book.
Note: I’ll be using git for revision control, so I also added in that last step to init this newly-created subdirectory as a git repository.
Create Project Using Maven 2
There’s a simple form you can fill out on the Wicket quickstart page to create a maven command that will create the project structure.
Fill out the form (I used com.om for the groupid and Cheesr for the artifactid), which produces the following command:
Execute that command:
Update POM
By default, the project depends on JUnit 3.x, so I update the POM.xml to instead depend on a newer version of JUnit.
Edit pom.xml under the Cheesr directory
Search for “junit”
Update the following line:
Use a newer version:
Create Eclipse Project Information
Now that you have an updated POM, you can create the eclipse project. The the Wicket quickstart page has instructions at the bottom.
Make sure you are in the project directory created by the initial mvn command.
Now we need to start Eclipse and make a few minor corrections:
Start Eclipse.
When asked for a directory, select the original directory you created (in my case, that’s /Users/schuchert/src/CheesrWorkspace)
Import existing project:
Right-click in Project Explorer
Select Import::Import…
Open General
Select Existing Projects into Workspace
Click **Next
Click **Browse
Click **Open
Click **Finish
The generated classpath uses a classpath variable: M2_REPO. Fix that next:
Go to the Eclipse Preferences Window (windows->Window:Preferences, Mac->Command,)
In the filter, type classpath
Select Classpath Variables under Java:Build Path
Click New
For the name, enter M2_REPO
For the path, enter the location of your Maven 2 repository. (In my case, it is ~/.m2/repository, but you must enter the full path, so it is actually: /Users/schuchert/.m2/repository.)
Click Ok
When asked to rebuild all, select Yes
Verify Everything Works
You can start you server to verify that it is working:
Find the Start.java class under src/test/java (in the one package created in the first step above)
Run it as a Java application
Start a browser (or browse to the following URL in Eclipse): http://localhost:8080/
Comments