2014-03-03 55 views
6

我想在沒有任何POM配置的Maven項目中強制執行Maven Enforcer Plugin的requireReleaseDeps規則,只是將其作爲命令行調用。在命令行上運行Maven Enforcer插件規則

按照文檔我應該能夠只是在規則的參數傳遞,像這樣

mvn enforcer:enforce -Drules=requireReleaseDeps 

也許這應該工作

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

但是這兩個調用導致

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

任何人都知道這種使用場景是否真正起作用或者我不得不跳入調試在這個階段插入插件來弄清楚這一點?

+1

我查看了[docs for the enforce goal](http://maven.apache.org/enforcer/maven-enforcer-plugin/enforce-mojo.html),並且沒有爲規則設置用戶屬性參數,這在我的經驗中意味着您無法使用-D從命令行定義屬性。 – user944849

+0

你能告訴我們你的pom嗎? –

+0

該pom沒有什麼感興趣的。它應該適用於任何項目。 –

回答

7

不幸的是,目前沒有這樣的功能,但已經有一個JIRA Issue for that

+1

遺憾的是,自2012年以來,JIRA票據就在那裏,仍然沒有采取行動 –

+0

如何爲此提供補丁? – khmarbaise

+0

我同意,這將是建立管道非常有用... –