【发布时间】:2021-02-11 05:13:18
【问题描述】:
我正在使用 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 版本,即latest。
如何正确使用-DexcludesList 参数?我关注了docs
我发现的唯一解决方法是排除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。
【问题讨论】:
-
是的,结果相同
标签: java maven maven-3 maven-versions-plugin scalatest-maven-plugin