Building JWebUnit with Maven 2

Maven is, just like ant, a build tool. However, where you have to tell ant what it needs to do and how, you only have to tell Maven what you need, if you adhere to the Maven standards.

In order to use Maven to build JWebUnit, you need to have Maven 2 installed. This should not be any more difficult than installing ant. We've included a best practise installation and configuration for Maven.

Installing Maven

First you need to download the latest Maven 2, which currently is Maven-2.0.9 , make sure you download the binary archive (e.g. apache-maven-2.0.9-bin.tar.bz2).

Installing Maven should be easy: unzip the file to any directory you like, let's say:

/opt/apache-maven-2.0.9

Next you need to do 2 things:

  • add an environment variable MAVEN_HOME which points to the install directory of Maven, i.e. /opt/apache-maven-2.0.8
  • add $MAVEN_HOME/bin to your path (using the variable you can switch more easily when a new version arrives)

Using Maven

Maven defines several goals, for creating and building your application. A goal is similar to an Ant-task. For instance: to compile the java sources one could do:

mvn compile
Also, a goal can depend on other goals: the package goal depends on running the unit tests and compilation of the code.

See the Maven site for more information on the different goals and plugins that are available.

Building JWebUnit

Building JWebUnit merely consist of running Maven:

mvn install

You now have successfully built JWebUnit. The files are in your private repository.

Building Sourceforge upload bundle

For those who don't want to use Maven, we have to provide a zip with all required files.

mvn package assembly:assembly

The files are in target directory.

Building JWebUnit Web site and reports

Due to findbugs memory usage, following parameter is required:

export MAVEN_OPTS=-Xmx384M
Now you should be able to generate site:
mvn site

The files are in target/site directory of each module.
If you want to test the final assembled site, just hit:

mvn site:stage -DstagingDirectory=C:\fullsite

You can of course customize the destination folder of the assembled site.