简体   繁体   English

使用漂亮的快照版本更新Maven依赖项属性

[英]Update Maven Dependency Properties With Pretty Snapshot Version

I currently have a maven release pipeline set up with multiple projects. 我目前有一个设置有多个项目的Maven发布管道。 I haven't been able to find a way to update dependency properties to the latest 'pretty' snapshot version after the mvn release:perform . 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): 发布之前的项目B pom.xml(伪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 . 在发行过程中, <project-a.version>会自动更新为最新发行版,在本例中为1.4.1

After the release, project B's pseudo pom looks like this: 发布后,项目B的伪pom如下所示:

<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. 出于开发和测试的原因,我希望根据最新的快照版本,在执行发行后将<project-a.version>设置为1.4.2-SNAPSHOT

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: 使用mvn versions:update-properties -DallowSnapshots=true可以完成此操作,但是它给我留下了非常丑陋的快照版本号,并使我与特定的快照工件绑定在一起:

<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 . 看一下maven update pom属性 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 答案中的链接基本上指向Mojo描述: http : //www.mojohaus.org/versions-maven-plugin/update-properties-mojo.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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