16

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?

4

4 回答 4

9

使用插件的 3.0.0-M3 版本和更新版本,enforcer 目标现在支持规则参数和命令行执行,而无需在 pom.xml 中进行配置。在https://maven.apache.org/enforcer/maven-enforcer-plugin/enforce-mojo.html#commandLineRules上查看更多信息

不幸的是,目前没有这样的功能,但已经有一个JIRA 问题

于 2014-03-03T21:59:44.327 回答
9

它适用于以下3.0.0-M3版本:

mvn org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce -Drules=requireReleaseDeps
于 2019-12-18T10:28:03.703 回答
6

它从 3.0.0 开始可用。已接受答案的 Jira 问题已解决:https ://issues.apache.org/jira/browse/MENFORCER-142

mvn enforcer:enforce -Drules=alwaysPass,alwaysFail
于 2019-02-04T14:14:06.230 回答
0

使用 Atlassian 的插件分支为我工作: mvn org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-atlassian-m01:enforce -Drules=...

我必须声明他们的插件存储库:

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

希望这可以帮助。

于 2019-06-14T10:27:50.663 回答