版本:属性的使用发布 [英] versions:use-releases for properties
问题描述
据我了解,versions:use-releases
不会更新用于在依赖项中定义版本的属性.
As I understand, versions:use-releases
does not update properties that are used to define versions in dependencies.
是否也可以更新这些属性?我看到我们有一个versions:update-properties
,但这是为了将版本更新为最新版本,而不仅仅是用发行版代替Snapshots.
Is it possible to update these properties as well? I saw that we have a versions:update-properties
, but it is meant to update versions to the latest versions, not just replace Snapshots by releases.
一个例子:
假设您具有类似的依赖关系
Assume you have dependency like
<dependency>
<groupId>de.something</groupId>
<artifactId>coutil</artifactId>
<version>${coutil.version}</version>
</dependency>
和coutil.version
被定义为7.0.0-SNAPSHOT
.
没有属性(即在版本标记中直接使用7.0.0-SNAPSHOT
),versions:use-releases
会将7.0.0-SNAPSHOT
替换为7.0.0
(如果存在).现在有了属性的间接作用,这种情况不再发生.
Without the property (i.e. with 7.0.0-SNAPSHOT
directly in the version tag), versions:use-releases
would replace 7.0.0-SNAPSHOT
by 7.0.0
(if this exists). Now with the indirection of the property, this no longer happens.
我尝试通过使用versions:update-properties
解决问题,在该情况下,我不允许进行主要,次要和增量更新(-DallowMajorUpdates=false
等),但是出现了意想不到的结果,就是用7.0.1-RC0002
代替7.0.0
代替了7.0.0-SNAPSHOT
>.
I tried to solve the problem by using versions:update-properties
where I disallowed major, minor and incremental updates (-DallowMajorUpdates=false
etc.), but it had the unexpected consequence of replacing 7.0.0-SNAPSHOT
by 7.0.1-RC0002
instead of 7.0.0
.
推荐答案
您可以使用版本插件的相对新版本更新任何属性. (我想,您至少需要vetition 2.5) 例如:
You can update any property with relative fresh version of versions plugin. (I guess, you need at least vetsion 2.5 ) e.g:
mvn org.codehaus.mojo:versions-maven-plugin:2.7:set-property -Dproperty=MyProperty -DnewVersion=MyValue org.codehaus.mojo:versions-maven-plugin:2.7:commit
这篇关于版本:属性的使用发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!