maven:找不到所需的目标

时间:2012-01-12 13:08:08

标签: maven

执行时:

mvn -Dplugin=dependency help:describe

我得到的很多目标:

...
dependency:get
  Description: Downloads a single artifact transitively from the specified
    remote repositories. Caveat: will always check the central repository
    defined in the super pom. You could use a mirror entry in your settings.xml
...    
dependency:help
  Description: Display help information on maven-dependency-plugin.
    Call
      mvn dependency:help -Ddetail=true -Dgoal=<goal-name>
    to display parameter details.
...

但如果我执行“mvn dependency:help”或“mvn dependency:get”,我会得到:

[INFO] Searching repository for plugin with prefix: 'dependency'.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Required goal not found: dependency:help in org.apache.maven.plugins:maven-dependency-plugin:2.0

这是正常的吗?这不仅发生在依赖插件上,也发生在其他插件上。 我的Maven版本是:

Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.6.0_30
Java home: c:\xxxx\jdk1.6.0_30\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"

1 个答案:

答案 0 :(得分:1)

这可能是依赖版本的问题:在每种情况下都使用了吗?如果help:describe正在向您显示有关Version:2.4的信息,但依赖:get正在寻找org.apache.maven.plugins:maven-dependency-plugin:2.0中的目标,那么这将符合我所看到的行为我当地的一个环境。

mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get

可能会提供更多线索。