0

mvn versions:update-properties -DexcludesList=org.scalatest:scalatest*用来排除scalatest.versionpom.xml 中的属性更新:

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

但是运行命令后scalatest.version会更新到最新3.3.0-SNAP2版本。

如何-DexcludesList正确使用论据?我跟着文档

我发现的唯一解决方法是排除以下SNAP2版本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:*:*:*无济于事。

使用 2.1 版versions-maven-plugin,更新到最新版本2.8.1并且仍然scalatest更新。

4

1 回答 1

1

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

mvn versions:update-properties -DexcludeProperties=scalatest.version achieved what i needed.

The docs

于 2020-10-28T19:40:34.210 回答