Dependency versioning in maven

When declaring dependencies in maven, you can specify the minimum version that the project depends on, but mvn execuse the latest binaries.

When creating a library, I would like to export to a minimal set of dependencies (for example, JUnit 4.0), but I always want to use the latest dependencies (for example, JUnit 4.8.1).

+5
source share
1 answer

You can manage version ranges for each dependency, for example:

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

This means that you expect at least version 4.0 junit, but the latest version will be used when it is available.

+9
source

All Articles