Wicket QuickStart Tutorial

So, you posted something to the Wicket mailing list saying that you thought you found a bug or you had a problem and were told to “create a quickstart” duplicating the problem.  And then you said “how”?  There are two ways and each will be described here:

Wicket QuickStart – The Maven Way

If you already have Maven running on your machine, I recommend using this method.  It is very simple, especially if you need to create more than one quickstart or if you hate downloading jars from all over the internet yourself.

  1. Enter the following command to create the archetype of a quickstart (a complete project, ready to run):
    1. mvn archetype:create -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.4-SNAPSHOT -DgroupId=com.example -DartifactId=test -DremoteRepositories=http://wicketstuff.org/maven/repository/
    2. For more about creating and using this quickstart, you can see: http://wicket.apache.org/quickstart.html
  2. Change directory into the project directory that was just created for you (i.e. “cd test”)
  3. Now to get the project ready for your IDE of choice, you can also use Maven.  Here is an example of how to do so with Eclipse:
    1. mvn eclipse:eclipse
    2. Note that your workspace will have to have the classpath variable M2_REPO set to point to the directory where your local Maven repository exists.  You can see this page for how to do that with Eclipse: http://maven.apache.org/plugins/maven-eclipse-plugin/usage.html

The quickstart is now created and ready for you to import into your IDE.  After you’ve imported it into your IDE, now comes the “duplicate the problem” part.  Try to create pages or components that reproduce the problem you were trying to report.  You can run the Start.java class from your IDE and go to http://localhost:8080/ to see your test application.

Cleaning up before you submit the quickstart

Once you have reproduced the desired behavior in your quickstart, it would be best to make it as small as possible before submitting.  The best way to do this is to run the “mvn clean” command from the project directory.  Then zip the whole directory up and submit the zip file.  (The mvn clean command removes all of the compiled classes and generated artifacts, generally in your “target” directory, leaving only the actual source.)

Wicket QuickStart – The Zip File Way

If you don’t have Maven installed, use these steps:

  1. Checkout the wicket-quickstart project by running this command:
    1. svn co http://svn.apache.org/repos/asf/wicket/trunk/wicket-quickstart
  2. Import or add that folder to your favorite IDE as a new project.
  3. You’ll need to add the following jars to your build path:
    1. wicket.jar (version of your choice)
    2. slf4j (I used 1.5.0)
    3. Some slf4j implementation (I used log4j which meant I also needed to add log4j to my build path)
    4. junit (I used 4.4)
    5. jetty and jetty-util (I used 6.1.11)
    6. servlet-api (I used 2.4)

Now, you’ll need to do the same as above: add your classes to reproduce the problem, run Start.java and view http://localhost:8080/quickstart to test it.  Once again, you’ll want to remove your “target” folder (or “bin”, etc) with all the compiled classes before submitting it.

If you choose this method, I’ve tried to assist by building this basic wicket quickstart zip file.  You should be able to download it (here: wicket-quickstart) and add it to Eclipse and just run with it.  I hope it works for you.  Of course, I provide no warranty for it, written or implied.

Be Sociable, Share!

2 thoughts on “Wicket QuickStart Tutorial

  1. Hi Jeremy,

    I found the content of this tutorial helpful. Thanks for explaining the quickstart steps. I don’t have maven and since I work in restricted environment, installing it is also not an option ( I dont have much knowledge of maven as well :) ).
    I tried to get the zip for the project, however the link seems to be corrupt.
    I managed to find http://sourceforge.net/projects/wicket/files/wicket-quickstart/.
    However this seems to be based on wicket 1.2 and I am using 1.6 version. Can you share quickstart link for 1.6 version.

    Thanks,
    Suvo

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>