Book Image

Apache Maven Cookbook

Book Image

Apache Maven Cookbook

Overview of this book

Table of Contents (18 chapters)
Apache Maven Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Controlling the constraints


One of the requirements for a build tool is to be able to generate repeatable builds. In a project, the build tool should behave identically for all team members. While a project guideline can be made on the version of Java or Maven to be used, it would be easier if it could be enforced automatically.

This is where the Maven Enforcer plugin comes in.

How to do it...

  1. Open a simple project (project-with-enforcer).

  2. Add the following plugin configuration:

          <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>
                <configuration>
                  <rules>
                    <requireMavenVersion>
                  ...