简体   繁体   English

适用于多模块项目的Maven版本插件-更新依赖版本

[英]Maven Release Plugin For Multi-module projects - Updating dependency versions

We have a multiple multi-module projects set up ie: 我们建立了多个多模块项目,即:

>    Proj1
>      parent
>      mod1
>      mod2
>     Proj2
>      parent
>      mod1
>      mod2

...

Proj2 depends on Proj1. Proj2取决于Proj1。 And so part of the pom.xml for Proj2 would be 所以Proj2的pom.xml的一部分是

>     <dependencies>
>     ....
>     <dependency>
>       <groupId>${project.groupId}</groupId>
>       <artifactId>ABCXYZ</artifactId>
>       <version>${Proj1.version}</version>
>     </dependency>
>     </dependencies>
>     <properties>
>       <Proj1.version>1.0.0.RELEASE</Proj1.version>
>     </properties>

The question now is, is it possible using the maven release plugin for me to automate the release of this Proj2 such that the new release of Proj1 is picked up and replaced in the <Proj1.version> tags. 现在的问题是,是否可以使用maven发行插件来自动执行此Proj2的发行,以便在<Proj1.version>标记中拾取并替换新发行的<Proj1.version> When I tried the regular mvn release:prepare-with-pom I got a prompt for the dependencies update but when I entered the new version, it replaced it in the <version> tag which isn't desired. 当我尝试使用常规的mvn release:prepare-with-pom提示您进行依赖项更新,但是当我输入新版本时,它会在不需要的<version>标记中替换它。

Thanks for any input 感谢您的输入

You may have a look to the update-properties goal of the versions-maven-plugin . 您可能会看到versions-maven-pluginupdate-properties目标。 I haven't use it for a while, it was working fine. 我有一段时间没有使用它了,它工作正常。

Your release workflow would be : 您的发布工作流程为:

  • Release Proj1 发行Proj1
  • Update <Proj1.version> of Proj2 using versions-maven-plugin 使用版本<Proj1.version> -plugin更新Proj2 <Proj1.version>
  • Commit Proj2 提交Proj2
  • Release Proj2 发布Proj2

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

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