我对詹金斯的输出有点困惑。
Jenkins 上的工作:(底部缩短了 pom.xml)
mvn deploy -Pprofile1
我的所有插件都会运行 4 次:
- 父/pom.xml
- 父/module1/pom.xml
- 父/module2/pom.xml
- 父/module3/pom.xml
I need:
-
第一个 Maven 插件: 只运行once在父 pom.xml 中
-
第二个 Maven 插件: 跑去every pom.xml
Why:
- first-maven-plugin:将在阶段运行:初始化 --> 相当长的清理操作。不想再这样4次了
- secondary-maven-plugin:将在所有 pom 的 stage:package --> necesaary 中运行。
父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>
您可以使用<inherited>false</inherited>
在第一个插件配置中。所以它只会在父pom执行中运行。
<build>
<plugins>
<plugin>
<groupId>com.test.plugin</groupId>
<artifactId>first-maven-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<inherited>false</inherited>
<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>
See https://stackoverflow.com/a/1671175 https://stackoverflow.com/a/1671175
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)