简体   繁体   中英

Update Maven Dependency Properties With Pretty Snapshot Version

I currently have a maven release pipeline set up with multiple projects. I haven't been able to find a way to update dependency properties to the latest 'pretty' snapshot version after the mvn release:perform .

To clarify, here is the release pipeline:

Release Project A --> Release Project B --> Release Project C...

Project B pom.xml before release (pseudo pom):

<version>1.2.1-SNAPSHOT</version>
<properties>
    <project-a.version>1.4.1-SNAPSHOT</project-a.version>
</properties>

During the release process, <project-a.version> is automatically updated to the latest release version, which in this case would be 1.4.1 .

After the release, project B's pseudo pom looks like this:

<version>1.2.2-SNAPSHOT</version>
<properties>
    <project-a.version>1.4.1</project-a.version>
<properties>

For development and testing reasons, I would like the <project-a.version> to be set to 1.4.2-SNAPSHOT after the release is performed, based on what the latest snapshot version is.

Using mvn versions:update-properties -DallowSnapshots=true kind of accomplishes this, but it leaves me with a very ugly snapshot version number and leaves me tied to a specific snapshot artifact:

<project-a.version>3b2a0d174a0658de1d3bfc777c248f83a8286e61-SNAPSHOT</project-a.version>

Is there anyway to get the general, 'pretty' version number? I'm assuming probably not, since the 'pretty' snapshot version number doesn't refer to one specific artifact, which is technically not a good idea.

Have a look at maven update pom property . You can define the new value and specify which properties should be updated. The links in the answer basically point to the Mojo desciption: http://www.mojohaus.org/versions-maven-plugin/update-properties-mojo.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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