Create a Wicket project by using an Archetype

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.

1. Software

Download the latest stable versions from the following websites.

2. Maven2

  1. Unzip the downloaded file to a location of your choice. e.g “D:\Programming\apache-maven-2.0.9\”
  2. 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 and value D:\Programming\apache-maven-2.0.9 Press OK
  3.  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_HOME system variable pointing to your JDK and the value %JAVA_HOME%\bin;  in your path variable.
  4. Close all dialogs and go to the command line by pressing WinKey + R or Start -> Run and type cmd.exe, press Enter.
  5. On the commandline type mvn --version press 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 exit Enter and re-open the command line (see step 4).

    Output Maven

    Output Maven

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.


4. Archetype (Creating the project)

  1. On the commandline go to your workspace directory e.g. “D:\Programming\Workspaces” by typing d: Enter and afterwards cd Programming\Workspaces Enter.
  2. Type mvn archetype:create -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.3.5 -DgroupId=com.mycompany -DartifactId=myproject and 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

  1. When everything is downloaded succesfull go to your project directory (“D:\Programming\Workspaces\myProject”) 
    Maven Archetype created successfull

    Maven Archetype created successfull


  2. Type mvn jetty:run and wait till it is completely started. The first time it will take some time.
  3. Open your favourite browser and browse to http://localhost:8080/myproject
  4. Now you will see a Wicket page.

6. Eclipse (optional)

  1. 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=true press Enter
    This will create some files for you to import the project in Eclipse.
  2. Open Eclipse, go to File -> Import
  3. Go to General -> Existing Projects in Workspace
  4. Press Browse and point to your project directory. Press Finish.
  5. 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

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>