Require Plugin Versions

This rule enforces that all plugins have a version defined, either in the plugin or pluginManagement section of the pom or a parent pom.

The following parameters are supported by this rule:

  • message - an optional message to the user if the rule fails.
  • banLatest - disallow any use of "LATEST" as a version for any plugin. Default = true
  • banRelease - disallow any use of "RELEASE" as a version for any plugin. Default = true

Sample Plugin Configuration:

<project>
  [...]
  <build>
   <plugins>
     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-plugin-versions</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requirePluginVersions>
                   <message>Best Practice is to always define plugin versions!</message>
                   <banLatest>true</banLatest>
                   <banRelease>true</banRelease>
                </requirePluginVersions>
              </rules>    
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  [...]
</project>