【发布时间】:2016-03-25 08:15:07
【问题描述】:
我对我的 Jenkins 输出有点困惑。
在 Jenkins 上的工作:(在底部缩短 pom.xml)
mvn deploy -Pprofile1
我所有的插件都会运行 4 次:
- 父/pom.xml
- 父/module1/pom.xml
- 父/module2/pom.xml
- 父/module3/pom.xml
我需要:
- first-maven-plugin:只在父 pom.xml 中运行 一次
- second-maven-plugin:为 every pom.xml 运行
为什么:
- first-maven-plugin:将在阶段运行:初始化 --> 相当长的清理操作。不要这样 4 次
- second-maven-plugin:将在 phase:package 中运行 --> 所有 pom 都需要。
父 pom.xml
<project ...>
<groupId>com.test.parent</groupId>
<modelVersion>4.0.0</modelVersion>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>parent</name>
<modules>
<module>module1</module>
<module>module2</module>
<module>module3</module>
</modules>
<profiles>
<profile>
<id>profile1</id>
<build>
<plugins>
<plugin>
<groupId>com.test.plugin</groupId>
<artifactId>first-maven-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<execution>
<id>execution1</id>
<phase>initialize</phase>
<goals>
<goal>doit</goal>
</goals>
</execution>
</plugin>
<plugin>
<groupId>com.test.plugin2</groupId>
<artifactId>second-maven-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<execution>
<id>another</id>
<phase>package</phase>
<goals>
<goal>goforit</goal>
</goals>
</execution>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
【问题讨论】:
-
这两个插件有
skip选项吗? -
插件没有跳过选项。它们是通用的,因为它们可以在多个项目上运行。
标签: maven plugins module profile