我正在尝试减少我们的maven pom文件中的复制/粘贴。
我们有一个主要的pom和许多继承自主人的儿童项目。
我想分享一个复杂的插件定义,如下所示:
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<configuration>
<!-- many xml lines here -->
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>assemble</goal>
<goal>generate-daemons</goal>
<goal>create-repository</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo.appassembler</groupId>
<artifactId>appassembler-booter</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</plugin>
...
</plugins>
当这个插件定义在项目pom中时,打包工作做得很好。
当定义移动到父pom(in或in)时,包装甚至都没有启动。
是否可以共享插件配置?怎么样 ?
- 在第一个答案后编辑---
我尝试过以下方法:
- 将我的XL包装插件配置放在我父pom的元素中
- 在元素中的项目pom中添加以下行:
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
</plugin>
...
</plugins>
但它不起作用...... 这可能有什么问题?
- 最后编辑 -
我想我得到了什么问题:
应该在配置文件构建中声明插件重用声明。
我在一个始终启用的插件中完成了它,现在它工作正常。
非常感谢。