Issue
I'm using enforcer
plugin in a multi-node project in the root pom, but I have one testing module, that I don't really care to run the plugin there since it won't create any jar and is only for testing purposes. Is there any way to skip one of the modules in the plugin config?.
Checking the documentation I cannot find anything. Only how to ban some specific dependencies. https://maven.apache.org/enforcer/enforcer-rules/bannedDependencies.html
The solution to put the plugin in each sub-module is possible but it's dangerous, since if I create a new sub-module I might forget to add it there.
Here my plugin config.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-maven-version-and-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.3.9</version>
</requireMavenVersion>
<bannedDependencies>
<searchTransitive>true</searchTransitive>
</bannedDependencies>
<dependencyConvergence></dependencyConvergence>
</rules>
</configuration>
</execution>
</executions>
<configuration>
<fail>true</fail>
</configuration>
</plugin>
Solution
In the POM of the module, set enforcer.skip
to true
:
<properties>
<enforcer.skip>true</enforcer.skip>
</properties>
Answered By - J Fabian Meier
Answer Checked By - Katrina (JavaFixing Volunteer)