我使用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中的rules.xml版本,如下所示:
<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。
发布于 2020-10-28 19:40:34
解决方案是使用-DexcludeProperties=scalatest.version参数。
mvn versions:update-properties -DexcludeProperties=scalatest.version实现了我所需要的。
The 文档
https://stackoverflow.com/questions/64579606
复制相似问题