This article describes step-by-step how to setup a Wicket Quickstart project by using Maven2 Archetype. After finishing all steps you’ll be able to run the Quickstart project in your favourite webbrowser. I assume that you already have a Java Development Kit (JDK) installed. Now lets get started.
Download the latest stable versions from the following websites.
- JDK (http://java.sun.com/javase/downloads/ )
- Maven2 (http://maven.apache.org/download.html )
- Eclipse (http://www.eclipse.org/downloads/ )
- Unzip the downloaded file to a location of your choice. e.g “D:\Programming\apache-maven-2.0.9\”
- Create a M2_HOME system variable
– Press WinKey + Pause or go to Settings -> Control Panel -> System. Now a System Properties dialog will appear. Go to Advanced -> Environment Variables.
– Press New and create a new system variable with name
- M2_HOME is added to the system variables. In the same list you’ll find a “Path” variable. Edit this variable and add
%M2_HOME%\bin;to the end of the list.
Make sure that there is also a
JAVA_HOMEsystem variable pointing to your JDK and the value
%JAVA_HOME%\bin;in your path variable.
- Close all dialogs and go to the command line by pressing WinKey + R or Start -> Run and type
cmd.exe, press Enter.
- On the commandline type
mvn --versionpress Enter and if everything is configured correct you will see Maven’s version number.
If it is not working properly close the command line by typing
exitEnter and re-open the command line (see step 4).
3. Maven2 Repository
By default Maven will create a local repository (.m2/repository) in your $user folder. If you want to specify the location of the local repository, create a file in $user/.m2/ called “settings.xml”. This file should contain the following lines. Change path if needed.
<settings> <localRepository>d:\programming\repository</localRepository> </settings>
4. Archetype (Creating the project)
- On the commandline go to your workspace directory e.g. “D:\Programming\Workspaces” by typing
d:Enter and afterwards
mvn archetype:create -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.3.5 -DgroupId=com.mycompany -DartifactId=myprojectand press Enter.
This will download all dependencies which are necessary and create a Maven2 project structure. It will create a directory with the name “myproject” in your workspaces directory and some Wicket quickstart files (in package “com.mycompany”). It will use Wicket version 1.3.5. You can change those properties to your needs!
5. Run Wicket’s Quickstart project
- When everything is downloaded succesfull go to your project directory (“D:\Programming\Workspaces\myProject”)
mvn jetty:runand wait till it is completely started. The first time it will take some time.
- Open your favourite browser and browse to http://localhost:8080/myproject 
- Now you will see a Wicket page.
6. Eclipse (optional)
- If you want to play around with the quickstart project. You have to import the project in your IDE. Before doing this you have to go to your project directory and type
mvn eclipse:eclipse -DdownloadSources=truepress Enter
This will create some files for you to import the project in Eclipse.
- Open Eclipse, go to File -> Import
- Go to General -> Existing Projects in Workspace
- Press Browse and point to your project directory. Press Finish.
- Now the project will be loaded in Eclipse and is ready for you to make changes.
7. Software used for this article
- JDK 1.6.0
- Maven 2.0.9
- Eclipse 3.4.0
- Windows XP / Vista