在命令行上运行Maven Enforcer插件规则 [英] Run Maven Enforcer Plugin rule on command line
问题描述
我想在Maven项目上强制执行Maven Enforcer插件的requireReleaseDeps规则,而无需进行任何POM配置,只需将其作为命令行调用即可.
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.
根据文档,我应该能够像这样传递rules参数
According to the docs I should be able to just pass in the rules parameter like so
mvn enforcer:enforce -Drules=requireReleaseDeps
或者也许应该起作用
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?
推荐答案
使用该插件的3.0.0-M3和更高版本,执行者目标现在支持pom中无需配置的rules参数和命令行执行.详情请参见 https://maven.apache.org /enforcer/maven-enforcer-plugin/enforce-mojo.html#commandLineRules
With the version 3.0.0-M3 of the plugin and newer release the enforcer goal now supports the rules parameter and command line execution without config in the pom. See more at https://maven.apache.org/enforcer/maven-enforcer-plugin/enforce-mojo.html#commandLineRules
不幸的是,目前没有这种功能,但是已经有一个 JIRA问题为此.
这篇关于在命令行上运行Maven Enforcer插件规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!