我的项目中有几个 POM,其中一些有父级指向我的存储库之外的工件。所以当我发布这个时,我应该为我的父母和我的项目有不同的版本。
我需要搜索具有“com.mycompany”作为父 groupId 和“myproduct”作为父 artifactId 的 POM,versions-maven-plugin
应该仅将父版本更新为 1.0.0。项目版本应保持不变。我稍后会正常更改项目版本。
我无法做到这一点。到目前为止我已经尝试过:我设计了一个 Rules.xml,其中包含:
<ruleset comparisonMethod="maven" xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 http://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
<rules>
<rule groupId="com.mycompany" artifactId="myproduct" comparisonMethod="maven"/>
<ignoreVersions>
<ignoreVersion type="regex">.*</ignoreVersion>
</ignoreVersions>
</rules>
</ruleset>
我已经调用了版本插件
mvn versions:set -DnewVersion=1.0.0 -DprocessProject=false -DrulesUri=file:///doc/Rules/Rules.xml -DgenerateBackupPoms=true
但这并没有更新这些 pom 的父版本。
我也为此调用了更新父级-
mvn versions:update-parent -DparentVersion=1.0.0 -DrulesUri=file:///doc/Jenkinsfiles/PR/version/Rules.xml -DgenerateBackupPoms=true
但这会为我更新所有父 pom。我猜我的 Rules.xml 也是错误的。但即便如此,父版本是任意的,而不是父版本。也许我不明白这个 maven 目标中 parentVersion 背后的含义。我需要它来更新到我选择的版本。