Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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).

like image 978
notnoop Avatar asked Dec 17 '09 15:12

notnoop


1 Answers

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.

like image 120
jrbalderrama Avatar answered Oct 18 '22 01:10

jrbalderrama