簡體   English   中英

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

[英]Exclude property using mvn versions:update-properties with 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:*:*:*無濟於事。

使用 2.1 版的versions-maven-plugin ,更新到最新的2.8.1並且仍然更新了scalatest

解決方案是使用-DexcludeProperties=scalatest.version參數。

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

文檔

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM