我使用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
达到了我的需要。
文档