What we need?
- Maven 3.03 which is the latest stable release at the time of writing.
- An IDE such as Eclipse or Netbeans.
What is Maven?
To know more about Maven please read the links below.Installing Maven
Building the Project
The most easy way to get started with Apache Wicket is to create a Wicket Quickstart Project with Maven. Apache wicket has provided a tool to generate the command line. In this example I will create a package/GroupId named “blogger.codeknowhow” which is where my HTML and Java files are located and a project name “hellowicket”. It is important to note that the project name or ArtifactId should be a single word.mvn archetype:generate -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.5.2 -DgroupId=blogger.codeknowhow -DartifactId=hellowicket -DarchetypeRepository=https://repository.apache.org/ -DinteractiveMode=false
Open command line or terminal and change directory to the directory where you want your project to be located.
cd path/to/myprojects
Copy and paste the generated code into the command line or terminal. If you have installed Maven correctly Maven will automatically download and setup the project.
Test your project change directory to your project directory in my case.
cd hellowicket
Inside the project directory start the jetty server.
mvn jetty:run
Maven will first compile our project and download all the dependencies that our Quickstart Project have setup. After that Maven will automatically start our jetty server. Now point your browser to http://localhost:8080 you should see
Open the Project to IDE
Eclipse
Eclipse needs to know the path to the local Maven repository.
mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo
To generate the Eclipse project files from your POMNow you can start developing your own wicket application!
mvn eclipse:eclipse
In Eclipse choose FILE->IMPORT->EXISTING PROJECT and navigate to the folder where your project exist, then import.
Netbeans
Netbeans by default has Maven project support so just OPEN PROJECT(CTRL+SHIFT+O), then navigate to your project folder.