禁用在父POM中定义的Maven插件 [英] Disable a Maven plugin defined in a parent POM

查看:715
本文介绍了禁用在父POM中定义的Maven插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个父POM,该父POM定义了一个我不想在子POM中运行的插件.如何完全禁用子pom中的插件?

I am using a parent POM that defines a plugin that I do not want to be run in a child POM. How can I disable the plugin in the child pom completely?

约束:我不能更改父级POM本身.

Constraint: I cannot change the parent POM itself.

推荐答案

在子POM中禁用Findbugs时,以下内容对我有用:

The following works for me when disabling Findbugs in a child POM:

<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中,因此它将继承该版本等等.

Note: the full definition of the Findbugs plugin is in our parent/super POM, so it'll inherit the version and so-on.

在Maven 3中,您需要使用:

In Maven 3, you'll need to use:

 <configuration>
      <skip>true</skip>
 </configuration>

用于插件.

这篇关于禁用在父POM中定义的Maven插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆