Run Maven Enforcer plugin rule at command line

I would like to apply the requireReleaseDeps rule for the Maven Enforcer Plugin in a Maven project without any POM configuration, just like a command line call.

According to the docs, I should be able to simply pass the rule parameter this way

mvn enforcer:enforce -Drules=requireReleaseDeps 

or maybe this should work

 mvn enforcer:enforce -Drules=org.apache.maven.plugins.enforcer.RequireReleaseDeps 

However, both of these calls lead to

 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce (default-cli) on project hel lo-world: The parameters 'rules' for goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce are missing or in valid -> [Help 1] 

Does anyone know if this use case really works, or do I need to dive into the debugging plugin at this point to figure this out?

+9
source share
3 answers

Unfortunately, there are currently no such functions, but there is already a JIRA Issue for this .

+8
source

It is available since 3.0.0. The Jira problem from the accepted answer has been resolved: https://issues.apache.org/jira/browse/MENFORCER-142

 mvn enforcer:enforce -Drules=alwaysPass,alwaysFail 
+1
source

Worked for me using the Atlassian fork plugin: mvn org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-atlassian-m01:enforce -Drules=...

I had to declare their plugin repository:

 <pluginRepositories> .... <pluginRepository> <id>atlassian-3rdparty</id> <url>https://maven.atlassian.com/3rdparty</url> </pluginRepository> </pluginRepositories> 

Hope this helps.

0
source

All Articles