1.5.x Maven Build and Continuous Integration
This page describes the maven build that has been introduced recently in the 1.5.x branch, and the continuous integration setup in our Jenkins instance.
Maven Build
We use maven to build Stripes artifacts and perform webtests. Our C.I. server fires maven builds.
We use the facilities provided by Sonatype for our maven repository : https://oss.sonatype.org/index.html
This allows us to deploy easily and sync with the maven central repository.
The maven build has the following modules structure :
- stripes-parent (pom)
- stripes (jar)
- tests
- examples (war)
- webtests (war, optional, activated by profile)
As we wanted to keep the ant build untouched, we had to adapt to the files and directories layout of this one. Thereby, the default source/resource folders settings are often overriden in each pom.
stripes-parent
The project's root pom. We inherit from sonatype's pom in order to automate our deployment to oss.sonatype.org and sync with maven central.
This module serves mainly to centralize dependencies, and to host the submodules.
stripes
The Stripes module : produces the Stripes jar. It's a regular jar packaging module, with a few tricks to generate .tld files and the javadocs/tlddocs.
The module doesn't contain any tests, because of the file layout we have. We had to create a separate module to host the tests (see below)
tests
Module containing the Stripes unit tests. Doesn't produce any useful artifact, but fails the whole build if some tests don't pass.
IMPORTANT: As tests are built in a separate submodule, the main stripes.jar could be installed in the local repository even if there are test failures. This is due to maven installing each module sequentially inside a multimodule project even if one fails later in the build (installation isn't atomic for a multi module build). We'll probably refactor this later to put the tests inside the stripes module, and remove this test module.
examples
The stripes-examples war project. Produces the war artifact with calculator, bugzooky etc.
webtests
An optional module included via the profile 'webtests'. Contains the canoo web tests for the example app, as well as the maven plumbing to download/start tomcat and run the tests against the webapp. You can run the webtests only (without rebuilding everything) against the latest examples war like this :
It basically starts tomcat (via cargo plugin) for the integration tests phase of the maven lifecycle, and deploys the example app. Canoo webtests are then fired against the app. A nice report is generated in webtests/target/test-classes/webtest-results/.
There's a trick to notice here. I couldn't find a way to configure cargo to deploy the examples app, so I made the webtests module a war packaging module without anything in it. It thereby overlays with the examples app (in dependencies), and produces a war that is used by cargo for deployment. This could be improved...
Useful commands
Here are a few useful commands :
1.5.x> mvn clean install
: compiles, tests and installs all stripes and examples in your local repo
1.5.x> mvn clean install -Dmaven.test.skip
: same than above, skipping the tests
1.5.x> mvn clean install -Pwebtests
: compiles, tests, webtests and installs stripes and examples in your local repo
You can build submodules individually of course ;
1.5.x/stripes> mvn clean install
: compiles and installs stripes in your local repo
1.5.x/tests> mvn clean install
: compiles and runs the tests on your latest installed stripes
1.5.x/webtests> mvn clean install
: runs the webtests on your latest instaled examples app
Continuous Integration
We use Jenkins in order to build Stripes continuously: http://www.stripesframework.org/jenkins/
At each commit, we produce the Stripes snapshot jar. There are currently two jobs for the 1.5.x branch.
Stripes 1.5.x branch
Builds Stripes jar (compiles, runs unit tests, and builds stripes.jar) and deploys to oss.sonatype.org. Runs whenever code is commited.
Stripes 1.5.x webtests
Executes the Stripes webtests. Runs whenever Stripes is built.