The Maven enforcer 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 multi-module 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>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
...