3
votes

For any moderately complex software project, you can quickly end up with complex dependency chains.

Consider the following dependency tree:

  A --> B --> C
     `--------^

Both A and B depend on C. As each project evolves, fixed dependencies prevent continuous integration. (e.g. if C is updated with a fix needed by A, B's dependency will also need to be udpated...) Using semantic versioning we can keep the modules in line with version ranges without constantly tweaking the poms.

[In reality this graph is more complex. We shouldn't need to combine everything into a multi-module project (or otherwise combine them) as this would defeats modularity. We want to build modular software with continuous integration.]

However deployed releases should be immutable. The versions they depend on should be fixed in stone, so a release picked up today (+ its dependencies) is the same as if used next year.

Goals:

  • Developers work on SNAPSHOT releases (picking SNAPSHOT dependencies either locally, or from Hudson)
  • Release are made against the latest (compatible) released versions of dependencies (excluding SNAPSHOTs)
  • Releases are forever immutable. Depending on A=1.0.0 will always bring in the same versions of B and C

Questions:

  • What's the best way to do this in Maven? Are there any links / documents describing this use case?
  • Can the maven release plugin resolve version ranges and bake them into the release?

Given:

  • By default maven (3.0.3) picks up SNAPSHOT dependencies in version ranges.
  • SNAPSHOTs and releases can be deployed to separate repositories

Is there a better way of doing continuous integration with maven?

1

1 Answers

0
votes

The release plugin won't release if any dependencies are SNAPSHOTs. That's how maven ensures a release is immutable. Create a small, multi-module test project and run the release plugin on it. Then you'll better understand it's behavior - it's what I had to do.

I work on a multi-module project with 405 POMs, built by Jenkins and deployed to Artifactory.