mavenmaven-2

Disable a Maven plugin defined in a parent 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?

Constraint: I cannot change the parent POM itself.


Solution

  • 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>
    

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

    In Maven 3, you'll need to use:

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

    for the plugin.