notnoop
notnoop

Reputation: 59299

Dependency version management in maven

When declaring dependencies in maven, can you specify the minimum version the project depends on to, but have mvn exec use the latest binaries.

When building a library, I would like to export to minimal set of dependencies (e.g. JUnit 4.0), but always want to use the latest dependencies myself (e.g. JUnit 4.8.1).

Upvotes: 5

Views: 1858

Answers (1)

jrbalderrama
jrbalderrama

Reputation: 176

You can manage version ranges for each dependency for instance:

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

It means you expect at least version 4.0 of junit but latest version will be used when available.

Upvotes: 9

Related Questions