Require Matching Coordinates
This rule checks that the Maven coordinates (i.e. the project's groupId
and artifactId
) each match a given pattern. Optionally one can also enforce that in a multi-module build the module directory name is always equal to the module's artifactId
.
The following parameters are supported by this rule:
- message - an optional message to the user if the rule fails. If not set a default message will be used.
- groupIdPattern - an optional regular expression, which must match the project's
groupId
. If not set there is no check on thegroupId
. - artifactIdPattern - an optional regular expression, which must match the project's
artifactId
. If not set there is no check on theartifactId
. - moduleNameMustMatchArtifactId - boolean flag to enforce that the the module's directory name is always equal to the module's
artifactId
. By defaultfalse
.
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-group-id</id> <goals> <goal>enforce</goal> </goals> <configuration> <rules> <requireMatchingCoordinates> <groupIdPattern>com\.example.\namespace\..*</groupIdPattern> </requireTextFileChecksum> </rules> </configuration> </execution> </executions> </plugin> </plugins> </build> [...] </project>