Usage
To use the maven-enforcer-extension, you must register the extension and configuration.
Maven Extension
You have 2 ways to use Maven extensions within your builds:
-
add
maven-enforcer-extension-3.5.0.jar
in${maven.home}/lib/ext
(no extra dependencies required), -
(since Maven 3.3.1) configure your extension in .mvn/extensions.xml.
There is actually a third way: add the extension to the pom.xml
, but in that case it makes more sense to use the maven-enforcer-plugin instead.
Enforcer Extension
The .mvn/enforcer-extension.xml
in the root of your Maven project is where you define your rules.
It's content is similar to an execution-block of the maven-enforcer-plugin
<extension>
<executions>
<execution>
<id/> <!-- default: default-extension -->
<phase/> <!-- default: validate -->
<configuration> <!-- see Plugin Configuration -->
<rules/>
</configuration>
</execution>
</executions>
</extension>