简体   繁体   English

maven中的依赖版本管理

[英]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. 在maven中声明依赖项时,是否可以指定项目所依赖的最小版本,但让mvn exec使用最新的二进制文件。

When building a library, I would like to export to minimal set of dependencies (eg JUnit 4.0), but always want to use the latest dependencies myself (eg JUnit 4.8.1). 在构建库时,我想导出到最小的依赖集(例如JUnit 4.0),但总是希望自己使用最新的依赖项(例如JUnit 4.8.1)。

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. 这意味着您至少期望版本4.0的junit,但最新版本将在可用时使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM