Book Image

Mastering Apache Maven 3

Book Image

Mastering Apache Maven 3

Overview of this book

Table of Contents (16 chapters)
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

The Maven enforcer plugin


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