Require Prerequisites

This rule enforces that the prerequisite is specified since it is not inherited from its parent. Defining the prerequisites is especially useful for plugins to enforce at least a certain version of Maven.

The following parameters are supported by this rule:

  • mavenVersion - an optional value contain a versionrange or the version at least required.

Sample Plugin Configuration:

<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.5.0</version>
        <executions>
          <execution>
            <id>enforce-prerequisites</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requirePrerequisite>
                  <mavenVersion>2.2.1</mavenVersion>
                </requirePrerequisite>
                <!-- same rule, different notation -->
                <requirePrerequisite>
                  <mavenVersion>[2.2.1,)</mavenVersion>
                </requirePrerequisite>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  [...]
</project>