Below are the step-by-step instructions that I put together a few months ago to install Wicket. They list everything I did to install Wicket on a vanilla machine with Eclipse installed.
Following the instructions in vicket Quick Launch , generating this Maven command:
mvn archetype:create -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.4.1 -DgroupId=com.mycompany -DartifactId=projName
Ran above Maven command line command
- Relevant files, including the Wicket source, were downloaded automatically based on POM.
- Ran
mvn eclipse:eclipse to create an Eclipse project based on above Imported project in Eclipse with File > Import..., Existing Projects
Ran Start.java in the test folder and found the test application in http://localhost:8080
Optional: support for third-party code, such as Wicket Extensions
Manually adding the Wicket Extensions JAR to the M2_REPO directory M2_REPO not work.
Instead, run mvn clean dependency:copy-dependencies after updating the POM. (Wicket Extensions is enabled, but commented out in POM by default.) Then configure the build path in Eclipse using Add Variables... (not Add JARs ), select M2_REPO , click Extend , find the desired JAR (in this case, Wicket Extensions).
A similar procedure should work for other third-party libraries.
I originally intended to update this web page with additional instructions, but lately I have been doing other things. In the end, I hope you find instructions on setting up a Wicket with Tomcat instead of relying solely on the server of the berth in which it is delivered.
UPDATE
Deployment instructions for Tomcat are here:
Download and install Apache Tomcat and Apache Ant .
Create the following directory structure:
\WicketTomcat +---src | +---main | | +---java | | | \---com | | | \---HelloWicket | | | HelloWorld.java | | | HelloWorld.html | | | HelloWorldApplication.java | | \---webapp | | \---WEB-INF | | web.xml | \---test | \---java +---lib | junit.jar | log4j.jar | servlet-api.jar | slf4j-api.jar | slf4j-log4j.jar | wicket.jar | wicket-extensions.jar +---target build.xml
Complete the files as follows:
HelloWorld.java
package com.HelloWicket; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; public class HelloWorld extends WebPage { public HelloWorld() { add(new Label("message", "Hello, Wicket!")); } }
HelloWorld.html
<html> <head> <title>Wicket Tomcat test title</title> </head> <body> <span wicket:id="message">Message goes here</span> </body> </html>
HelloWorldApplication.java
package com.HelloWicket; import org.apache.wicket.Page; import org.apache.wicket.protocol.http.WebApplication; public class HelloWorldApplication extends WebApplication { public HelloWorldApplication() { } @Override public Class<? extends Page> getHomePage() { return HelloWorld.class; } }
web.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>Extremely simple example of deploying Wicket on Tomcat</display-name> <context-param> <param-name>configuration</param-name> <param-value>development</param-value> </context-param> <filter> <filter-name>HelloWicket</filter-name> <filter-class> org.apache.wicket.protocol.http.WicketFilter </filter-class> <init-param> <param-name>applicationClassName</param-name> <param-value> com.HelloWicket.HelloWorldApplication </param-value> </init-param> </filter> <filter-mapping> <filter-name>HelloWicket</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
build.xml
<?xml version="1.0" encoding="UTF-8"?> <project default="war" name="HelloWicket" basedir="."> <property name="final.name" value="HelloWicket" /> <property name="src.main.dir" value="src/main/java" /> <property name="src.test.dir" value="src/test/java" /> <property name="src.web.dir" value="src/main/webapp" /> <property name="lib.dir" value="lib" /> <property name="build.dir" value="target" /> <property name="build.main.classes" value="${build.dir}/classes" /> <property name="build.test.classes" value="${build.dir}/test-classes" /> <property name="build.test.reports" value="${build.dir}/test-reports" /> <property name="build.reports.dir" value="${build.dir}/reports" /> <property name="tomcat.dir" value="..\..\..\..\Program Files\Apache Software Foundation\apache-tomcat-7.0.22\webapps" /> <path id="build.classpath"> <fileset dir="${lib.dir}"> <include name="**/*.jar" /> </fileset> </path> <target name="clean"> <delete dir="${build.dir}" failonerror="false" /> <delete file="${final.name}.war" failonerror="false" /> </target> <target name="init"> <mkdir dir="${build.dir}" /> </target> <target name="compile" depends="init"> <mkdir dir="${build.main.classes}" /> <javac destdir="${build.main.classes}" target="1.6" source="1.6" srcdir="${src.main.dir}" classpathref="build.classpath" includeantruntime="false" /> <copy todir="${build.main.classes}"> <fileset dir="${src.main.dir}"> <include name="**/*.*" /> <exclude name="**/*.java" /> </fileset> </copy> </target> <target name="test-compile" depends="compile"> <mkdir dir="${build.test.classes}" /> <javac destdir="${build.test.classes}" target="1.6" source="1.6" srcdir="${src.test.dir}" includeantruntime="false"> <classpath> <path refid="build.classpath" /> <pathelement path="${build.main.classes}" /> </classpath> </javac> <copy todir="${build.test.classes}"> <fileset dir="${src.test.dir}"> <include name="**/*.*" /> <exclude name="**/*.java" /> </fileset> </copy> </target> <target name="test" depends="test-compile"> <mkdir dir="${build.test.reports}" /> <junit dir="./" failureproperty="test.failure" printSummary="yes" fork="true" haltonerror="true"> <sysproperty key="basedir" value="." /> <formatter type="xml" /> <classpath> <path refid="build.classpath" /> <pathelement path="${build.main.classes}" /> <pathelement path="${build.test.classes}" /> </classpath> <batchtest todir="${build.test.reports}"> <fileset dir="${src.test.dir}"> <include name="**/*Test*.java" /> </fileset> </batchtest> </junit> <mkdir dir="${build.reports.dir}" /> <junitreport todir="${build.reports.dir}"> <fileset dir="${build.test.reports}"> <include name="TEST-*.xml" /> </fileset> <report format="frames" todir="${build.reports.dir}" /> </junitreport> </target> <target name="war" depends="test"> <war destfile="${build.dir}/${final.name}.war" webxml="${src.web.dir}/WEB-INF/web.xml"> <lib dir="lib"> <include name="wicket*.jar" /> <include name="slf4j*.jar" /> <include name="log4j*.jar" /> <include name="servlet*.jar" /> </lib> <classes dir="${build.main.classes}" /> <fileset dir="${src.web.dir}"> <include name="**/*" /> <exclude name="**/web.xml" /> </fileset> </war> </target> <target name="deploy" depends="war"> <echo>Deploying .war to local Tomcat</echo> <copy todir="${tomcat.dir}"> <fileset dir="${build.dir}" includes="${final.name}.war" /> </copy> </target> </project>
As with the original answer, I posted a slightly more explanatory version of this answer here , but that really should be enough to get you going.