maven依赖指定版本范围或者最新版本

在maven中我们经常像下面这样引用一个依赖:

<dependency>
  <groupId>wonderful-inc</groupId>
  <artifactId>dream-library</artifactId>
  <version>1.2.3</version>
</dependency>

我们指定了固定的版本1.2.3,如果我们想每次都引用最新版本,是否可以呢?答案是可以的,在pom文件的定义中,可以使用版本的一个范围,版本范围的写法说明如下:

  • (,1.0] x <= 1.0
  • 1.0 "Soft" requirement on 1.0 (just a recommendation - helps select the correct version if it matches all ranges)
  • [1.0] Hard requirement on 1.0
  • [1.2,1.3] 1.2 <= x <= 1.3
  • [1.0,2.0) 1.0 <= x < 2.0
  • [1.5,) x >= 1.5
  • (,1.0],[1.2,) x <= 1.0 or x >= 1.2. Multiple sets are comma-separated
  • (,1.1),(1.1,) This excludes 1.1 if it is known not to work in combination with this library

转自:http://outofmemory.cn/code-snippet/12469/maven-specify-version-range

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值