The largest Interview Solution Library on the web

« Previous | 1 | 2 | 3 | Next »

Rest - Building and Testing Jersey

13.1. Checking out the source

The Jersey source code is available from the Subversion repository located at

To check out the trunk where active development on the next release occurs use the following command:

svn checkout jersey --username <username>

If you are new to Subversion, you may want to visit the Subversion Project website and read Version Control with Subversion.

Read more about how to checkout this project's repository...
Stable releases of Jersey are tagged in the location

The source code may be browsed using FishEye.

13.2. Building using Maven

Java SE 6 or greater is required. Maven 2.2.1 or greater is recommended.

It is recommended to build the whole of Jersey after you have initially checked out the source code. To build all of Jersey use the following command from the checked out jersey directory:

mvn clean install

To skip all the tests do:

mvn -Dmaven.test.skip=true clean install

The following maven options are recommended:

-Xmx1048m -XX:PermSize=64M -XX:MaxPermSize=128M

Building the whole Jersey project including tests could take about an hour, depending on your system performance of course. Even if you have a pretty fast performant machine, this could be quite annoying. Especially if you just want to experiment with a limited amount of code. To avoid building the whole Jersey project tree, you can easily utilize the maven reactor plugin.

To build only the modules needed for the helloworld example, you can launch:

mvn reactor:make -Dmake.goals=clean,install -Dmake.folders=samples/helloworld

which takes less then 2 minutes on my machine. To switch testing off, when building the same set of modules, you will use:

mvn reactor:make -Dmake.goals=-Dmaven.test.skip,clean,install -Dmake.folders=samples/helloworld

13.3. Testing

Jersey contains many unit tests. Most of these are not really unit tests per-say and are functional tests using the JUnit test framework because it is very convientient for execution and reporting.

Some modules have specific tests but most tests associated with testing the jersey-core, jersey-client and jersey-server modules are located in the jersey-test module.

This module can take some time to execute all the tests so it is recommended that you pick the appropriate tests to run related to the particular area that is being investigated. For example, using:

mvn -Dtest=<pattern> test

where pattern may be a comma separated set of names matching tests.

13.4. Continuous building and testing with Hudson

Jersey is built, tested and deployed on Solaris, Windows and Linux using an interal Hudson server. The Jersey Hudson jobs are available publically at

13.5. Using NetBeans

NetBeans 6.8 or greater has excellent maven support. The Jersey maven modules can be loaded, built and tested in NetBeans without any additional project-specific requirements.
« Previous | 1 | 2 | 3 | Next »

copyright © 2014 - all rights riserved by