问题描述
我的项目继承的POM包含一些< pluginManagement>
,用于发布
插件,它指定了一些额外的参数
。
The POM that my project inherits contains some <pluginManagement>
for the release
plugin that specifies some additional arguments
.
我的问题是:有没有办法覆盖 arguments
在这种情况下来自命令行的参数?
My question is: Is there a way to override the arguments
parameter from the command line in this case?
父POM有这个:
<pluginManagement>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<arguments>-Prelease</arguments>
</configuration>
</plugin>
</pluginManagement>
由于命令行参数不起作用:
Due to that the command line argument doesn't work:
mvn release:prepare -Darguments="-Pmock -Prelease"
-Darguments = - Pmock -Please
部分无效。当参数
尚未指定时,它可以正常工作。
The -Darguments="-Pmock -Prelease"
part has no effect. When arguments
is not already specified, it works.
我无法修改父POM或不要使用它。
It is not possible for me to modify the parent POM or not to use it.
推荐答案
找到解决方案。在 my POM中,我添加了这个,它会覆盖 parent POM中的设置,并允许在命令行上指定其他参数,例如: -Darguments = -Pmock
Found the solution. In my POM I add this which overrides the settings in the parent POM and allows to specify additional arguments on command line, e.g. -Darguments=-Pmock
<pluginManagement>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<arguments>${arguments} -Prelease</arguments>
</configuration>
</plugin>
</pluginManagement>
这篇关于从命令行覆盖pom pluginManagement中定义的Maven插件配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!