使用mvn版本排除属性:使用excludesList更新属性



我使用mvn versions:update-properties -DexcludesList=org.scalatest:scalatest*排除pom.xml中属性scalatest.version的更新:

<properties>
<scalatest.version>3.0.5</scalatest.version>
</properties>

但是在运行命令之后,scalatest.version被更新为最新的3.3.0-SNAP2版本。

如何正确使用-DexcludesList参数?我遵循了文档

我找到的唯一解决方法是排除rules.xml中的SNAP2版本,如下所示:

<ruleset xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" comparisonMethod="maven" 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">
<ignoreVersions>
<ignoreVersion type="regex">9.*</ignoreVersion>
<ignoreVersion type="regex">6.1.*</ignoreVersion>
<ignoreVersion type="regex">.*SNAP.*</ignoreVersion>
</ignoreVersions>
<rules>
</rules>
</ruleset>

并运行mvn versions:update-properties -Dmaven.version.rules=file:////tmp/rules.xml -DexcludesList=org.scalatest:scalatest*

通过这种方式,scalatest被更新为3.2.2。我想完全忽略scalatest版本的更新。

尝试了不同的变体:-DexcludesList=org.scalatest:scalatest:*-DexcludesList=org.scalatest:scalatest:*:*:*均无效。

使用versions-maven-plugin的2.1版本,更新为最新的2.8.1,并且仍然更新了scalatest

解决方案是使用-DexcludeProperties=scalatest.version参数。

mvn versions:update-properties -DexcludeProperties=scalatest.version达到了我的需要。

文档

相关内容

最新更新