The Maven enforcer plugin

The Maven Enforce plugin lets you control or enforce constraints in your build environment. These could be the Maven version, Java version, operating system parameters, and even user-defined rules.

The plugin defines two goals: enforce and displayInfo. The enforcer:enforce goal will execute all the defined rules against all the modules in a multimodule Maven project, while enforcer:displayInfo will display the project compliance details with respect to the standard rule set.

The maven-enforcer-plugin is not defined in the super POM, and should be explicitly defined in your project POM file:

<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-enforcer-plugin</artifactId> <version>1.3.1</version> ...

Get Maven Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.