Run Maven Enforcer Plugin rule on command line

不打扰是莪最后的温柔 提交于 2019-12-23 07:27:27

问题


I would like to enforce the requireReleaseDeps rule of the Maven Enforcer Plugin on a Maven project without any POM configuration simply as a command line call.

According to the docs I should be able to just pass in the rules parameter like so

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 result in

[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]

Anybody know if this usage scenario actually works somehow or do I have to dive into debugging the plugin at this stage to figure this out?


回答1:


Unfortunately there is currently no such functionality but there is already a JIRA Issue for that.




回答2:


It is available from 3.0.0. The Jira issue from accepted answer got resolved: https://issues.apache.org/jira/browse/MENFORCER-142

mvn enforcer:enforce -Drules=alwaysPass,alwaysFail



回答3:


Worked for me using Atlassian's fork of the 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.




回答4:


It works with the 3.0.0-M3 version:

mvn org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce -Drules=requireReleaseDeps


来源:https://stackoverflow.com/questions/22157668/run-maven-enforcer-plugin-rule-on-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!