如何使Maven使用版本范围内的最新发行版? [英] How to make maven use the latest release version within version range?

查看:89
本文介绍了如何使Maven使用版本范围内的最新发行版?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的maven项目中,我使用如下依赖项:

In my maven project I use dependencies like this:

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>[4.2.2, 5.0)</version>
</dependency>

由于下一个主要版本(5.0)可能会更改API,因此我希望我的项目使用分支机构4.x可用的最新稳定版本.

Since the next major version (5.0) may change the API, I want my project to use the latest stable version available for branch 4.x.

今天早上的错误调查告诉我,此表达式[4.2.2,5.0)抢占了任何版本.就我而言:4.3-alpha1.

This morning bug investigation told me this expression [4.2.2, 5.0) grabs any version available. In my case: 4.3-alpha1.

如何使Maven使用版本范围内的最新发行版?

How to make maven use thelatest release version within version range?

推荐答案

查看

依赖关系范围的解析不应解析为快照(开发版本),除非将其作为显式边界包括在内.

Resolution of dependency ranges should not resolve to a snapshot (development version) unless it is included as an explicit boundary.

除非工件版本以-SNAPSHOT结尾,否则Maven将认为它是有效的发行版.据我所知,-alpha1对Maven没有特殊意义.这只是另一个随机限定词.

Unless the artifact version ends with -SNAPSHOT, Maven is going to consider it a valid release build. As far as I know, -alpha1 has no special meaning to Maven. It's just another random qualifier.

无论如何,我强烈建议您放弃版本范围.可预测的构建应该是任何稳定项目的目标,并且版本范围也应运而生.

I would strongly recommend you forgo the version range, anyway. Predictable builds should be the goal of any stable project and version ranges fly in the face of that.

这篇关于如何使Maven使用版本范围内的最新发行版?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆