Brandon
Brandon

Reputation: 33

Build Pipelining and Continuous Integration with Maven and Hudson

Currently the my team is considering splitting our single CI build process into a more streamlined multi-stage process to speed up basic build feedback and isolate different ci concerns. The idea we had was to have each stage exist in Hudson as a different build with the correct maven goal or maven plugin execution, then chain them together using the post-build hooks of Hudson.

However to my knowledge, Maven as a build tool mandates that any lifecycle phase which is performed automatically builds every preceding lifecycle phase. This presents a number of problems the most significant of which is that maven is recreating the build resources with each distinct call and not using those of the previous stage. This not only breaks the consistency of the build lifecycle but has much more unnecessary processing overhead.

Is there a way to accomplish pipelining with CI using Maven? Assuming there is, is there a way to let Hudson know to use those resources built from the previous stage in the next one?

Upvotes: 3

Views: 1771

Answers (3)

luuuis
luuuis

Reputation: 141

I've had good success pipelining a Maven build in CI (though with Bamboo, not Hudson). I used GMaven to run a script that creates a single-use pom.xml. The generated pom.xml contains:

  • A <property> for each property that is defined in stage 1
  • A <dependency> for each dependency that will be needed in stage 2 (i.e. the test classpath). The key is to use scope=system and include the path to the artifact that was build in the previous stage.

This is then zipped together with the built artifacts and passed to stage 2. You could easily turn this into a Maven plugin, especially if you used GMaven.

I blogged about a build pipeline here, but there is not much detail about the Maven part of it.

Upvotes: 0

Peter Schuetze
Peter Schuetze

Reputation: 16305

In addition to the general approach of just sharing build artifacts through an external repository (e.g. structured file share), you can either archive the artifacts needed with Hudson's on board options or use the Clone Workspace Plugin. Have a look at issue HUDSON-682 that let to the creation of this plugin.

Upvotes: 0

Pascal Thivent
Pascal Thivent

Reputation: 570595

I don't think this is well supported (see sharing build artifacts between jobs in hudson) and even less when using Maven.

Upvotes: 1

Related Questions