Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Versioning for a maven project with small, very frequent releases

I'm converting an ant project to a maven one. This project differs from the ones I've usually converted since it has very frequent releases, typically 8-10 times per day.

By release I mean that the resulting jar is packaged and included in the production enviroment. This project is a leaf one, so it publishes no API, it only consumes it. It is also at most a runtime dependency for two other projects.

I'd like to have a versioning scheme where:

  • it's easy to deploy without forcing the developers to think about what version number to assign to the project, since the number is meaningless;
  • It's easy to include the latest version of this project as a dependency without constantly bumping up dependency versions;

Most likely the dependency version would not be a -SNAPSHOT, since that would conflict with the maven-release-plugin we're using for other projects, but I'm open to suggestions.

like image 679
Robert Munteanu Avatar asked Oct 06 '09 08:10

Robert Munteanu


1 Answers

Actually, you can use x-SNAPSHOT version and still use the maven-release-plugin. Just use mvn release:prepare before mvn release:perform to prepare your release and change the version in the poms from x-SNAPSHOT to a new version (you will be prompted for the versions to use). You can check out this introduction to the maven-release-plugin for a quick overview of release:prepare and release:perform.

Then, to include the latest version without constantly updating dependencies version, you could use dependency ranges like in the following snippet where we specify a range Junit 3.8 - Junit 4.0:

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>[3.8,4.0)</version>
  <scope>test</scope>
</dependency>

A version before or after the comma is not required, and means +/- infinity. For example, [4.0,) means any version greater than or equal to 4.0.

Personally, I don't like to use dependency ranges that much because I find that it can lead to build reproducibility issues and makes the build more fragile.

But you may have good reasons to use them.

like image 99
Pascal Thivent Avatar answered Oct 24 '22 05:10

Pascal Thivent