2010-03-21 47 views
2

我是Maven中的新成員。你知道我做錯了什麼嗎(見下文)?Maven:無法獲得幫助目標的工作(清理:幫助,編譯器:幫助等)


 
mvn -e clean:help. 
+ Error stacktraces are turned on. 
[INFO] Scanning for projects... 
[INFO] Searching repository for plugin with prefix: 'clean'. 
[INFO] ------------------------------------------------------------------------ 
[ERROR] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Required goal not found: clean:help in org.apache.maven.plugins:maven-clean-plugin:2.2 
[INFO] ------------------------------------------------------------------------ 
[INFO] Trace 
org.apache.maven.BuildFailureException: Required goal not found: clean:help in org.apache.maven.plugins:maven-clean-plugin:2.2 
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1867) 
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:462) 
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:175) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328) 

回答

4

您正在使用的命令行(2.2)上不具有clean:help目標(因爲2.3)插件的版本。試試這個:

mvn org.apache.maven.plugins:maven-clean-plugin:2.4:help 
+0

謝謝,但你知道爲什麼maven不會自動下載這個版本嗎?我認爲默認規則是獲取插件的最新版本...... – SirFabel 2010-03-21 22:33:05

+0

@SirFabel不,核心插件的版本在超級pom中是固定的(參見http://www.sonatype.com/books/mvnref-book/reference/ pom-relationships-sect-pom.html#ex-super-pom)用於構建再現性(http://jira.codehaus.org/browse/MNG-3395)。 – 2010-03-21 22:46:31

3

我想你想:

mvn help:describe -Dcmd=clean 

這給:

[INFO] [help:describe {execution: default-cli}] 
[INFO] 'clean' is a lifecycle with the following phases: 
* pre-clean: Not defined 
* clean: org.apache.maven.plugins:maven-clean-plugin:clean 
* post-clean: Not defined 

的更多細節和例子見here。這同樣適用於compile

mvn help:describe -Dcmd=compile 
+0

謝謝。這不是我正在尋找的東西,但信息很有趣。 – SirFabel 2010-03-21 22:33:55