在子 POM 中禁用 Findbugs 时,以下对我有用:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<executions>
<execution>
<id>ID_AS_IN_PARENT</id> <!-- id is necessary sometimes -->
<phase>none</phase>
</execution>
</executions>
</plugin>
注意:Findbugs 插件的完整定义在我们的父/超级 POM 中,所以它会继承版本等等。
在 Maven 3 中,您需要使用:
<configuration>
<skip>true</skip>
</configuration>
对于插件。
查看插件是否具有“跳过”配置参数。几乎所有人都这样做。如果是这样,只需将其添加到孩子的声明中:
<plugin>
<groupId>group</groupId>
<artifactId>artifact</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
如果没有,那么使用:
<plugin>
<groupId>group</groupId>
<artifactId>artifact</artifactId>
<executions>
<execution>
<id>TheNameOfTheRelevantExecution</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<configuration tiles-keep-id="true" />
标记应添加到执行中以保留指定的执行 ID。
线程很旧,但也许有人仍然感兴趣。我发现的最短形式是对 λlex 和 bmargulies 示例的进一步改进。执行标签将如下所示:
<execution>
<id>TheNameOfTheRelevantExecution</id>
<phase/>
</execution>
我要强调的两点:
阶段设置为空,看起来没有“无”那么骇人听闻,尽管仍然是骇客。 id 必须与您要覆盖的执行相同。如果你没有指定 id 来执行,Maven 会隐式地执行它(以一种你不希望直观的方式)。
发布后发现它已经在stackoverflow中:In a Maven multi-module project, how can I disable a plugin in one child?
我知道这个线程真的很老,但@Ivan Bondarenko 的解决方案在我的情况下帮助了我。
我的 pom.xml
中有以下内容。
<build>
...
<plugins>
<plugin>
<groupId>com.consol.citrus</groupId>
<artifactId>citrus-remote-maven-plugin</artifactId>
<version>${citrus.version}</version>
<executions>
<execution>
<id>generate-citrus-war</id>
<goals>
<goal>test-war</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
我想要的是为特定配置文件禁用 generate-citrus-war
的执行,这就是解决方案:
<profile>
<id>it</id>
<build>
<plugins>
<plugin>
<groupId>com.consol.citrus</groupId>
<artifactId>citrus-remote-maven-plugin</artifactId>
<version>${citrus.version}</version>
<executions>
<!-- disable generating the war for this profile -->
<execution>
<id>generate-citrus-war</id>
<phase/>
</execution>
<!-- do something else -->
<execution>
...
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
不定期副业成功案例分享
<id>…</id>
部分,然后它对我有用。<skip>
参数。