我正在处理的Maven项目继承了父POM,其中一些项目范围的变量是通过在验证阶段执行gmaven-plugin来计算的:
父级POM:
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5-jenkins-1</version>
<executions>
<execution>
<phase>validate</phase>
<goals><goal>execute</goal></goals>
<configuration>
<providerSelection>2.0</providerSelection>
<source>
project.properties.put("test.property1", "123");
</source>
</configuration>
</execution>
</executions>
</plugin>现在,我还想在子POM中使用gmaven-plugin来计算和设置一些附加参数:
儿童POM:
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5-jenkins-1</version>
<executions>
<execution>
<phase>validate</phase>
<goals><goal>execute</goal></goals>
<configuration>
<providerSelection>2.0</providerSelection>
<source>
project.properties.put("test.property2", "abc");
</source>
</configuration>
</execution>
</executions>
</plugin>但是,这会导致父程序中定义的插件消失/被覆盖。有效的POM只包含在子程序中定义的插件,test.property1以null结尾。
如何在父程序中执行Maven插件,在子程序中执行另一个插件,而不使它们相互干扰?
发布于 2015-10-05 12:24:20
add :
<inherited>true</inherited>
like :
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5-jenkins-1</version>
<inherited>true</inherited>发布于 2015-10-05 11:09:31
阅读这博客条目如何合并信任。这也许能解决你的问题。
发布于 2015-10-05 11:14:00
据我所知,您只需在子程序的pom中配置另一个执行部分,那么所有对父插件的引用都将消失。
https://stackoverflow.com/questions/32946698
复制相似问题