versions:use-releases for properties

爷,独闯天下 提交于 2020-05-11 02:54:03

问题


As I understand, versions:use-releases does not update properties that are used to define versions in dependencies.

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.

An example:

Assume you have dependency like

<dependency>
    <groupId>de.something</groupId>
    <artifactId>coutil</artifactId>
    <version>${coutil.version}</version>
</dependency>

and coutil.version is defined to be 7.0.0-SNAPSHOT.

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.

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.


回答1:


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


来源:https://stackoverflow.com/questions/54940280/versionsuse-releases-for-properties

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!