Fork me on GitHub

Usage

To use any of the extra rules you just need to add the extra rules as a dependency of the Apache Maven Enforcer Plugin. This is best achieved by adding the dependency within a pluginManagement section

<project>
  [...]
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.4.1</version> <!-- find the latest version at http://maven.apache.org/plugins/maven-enforcer-plugin/ -->
          <dependencies>
            <dependency>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>extra-enforcer-rules</artifactId>
              <version>1.8.0</version>
            </dependency>
          </dependencies>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  [...]
</project>

Note: If you are using Maven 2.x then, as a result of the classloader design in Maven 2.x, you may need to use the pluginManagement technique in the ultimate parent of your reactor build in order to ensure that the rule is available.

Note: If you want to extend rules in child poms read the article about extending or replacing plugin configurations on this page at Sonatype

Trademarks

Apache, Apache Maven, Maven and the Apache feather logo are trademarks of The Apache Software Foundation.