views:

258

answers:

1

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

+4  A: 

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.

javier