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:
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With