# Building and testing Jersey

## Checking out the source

The Jersey source code is available from the Subversion repository located at http://java.net/projects/jersey/sources/svn/show. You can also read more about how the top level of the `jersey' Subversion repository is structured at that same link.

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

    svn checkout https://svn.java.net/svn/jersey~svn/trunk/jersey jersey --username <username>

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

Stable releases of Jersey are tagged in the location http://java.net/projects/jersey/sources/svn/show/tags.

The source code may be browsed using FishEye.

## 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

## 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.

## 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 http://hudson.glassfish.org/job/Jersey-trunk-multiplatform/.

## 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.