gpt4 book ai didi

maven - 从命令行覆盖 Maven 插件版本?

转载 作者:行者123 更新时间:2023-12-04 18:30:51 27 4
gpt4 key购买 nike

如何覆盖插件的 版本在命令行中 没有 更改 pom.xml?

进一步来说:

我无法编译 apache shiro commit 8dd6a13。原因是 buildnumber-maven-plugin 版本 1.0-beta-4 不再可用。
当我修改 pom.xml 并将插件版本更改为 1.0 时,我可以编译项目。
我想保持项目不变,并在我从命令行运行 mvn 时设置插件的版本。
我感谢任何见解和帮助。

        <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0-beta-4</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
</plugin>

最佳答案

您可以使用 maven 属性来设置默认版本,当您从命令行运行时,您将有可能覆盖它。

<properties>
<buildnumber.version>1.0-beta-4</buildnumber.version>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>${buildnumber.version}</version>

...

<plugin>
<plugins>
<build>

现在你可以运行,例如:
mvn clen install -Dbuildnumber.version=1.0

命令行 Maven 中没有设置属性将使用 pom.xml 中的默认值

关于maven - 从命令行覆盖 Maven 插件版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42639700/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com