2008-11-21 30 views
4

如果我键入命令:为什么不能找到一个插件?

mvn dependency:list 

docs认为我会得到我的项目的依赖列表。相反,我得到这个:

[INFO] Searching repository for plugin with prefix: 'dependency'. 
[INFO] ----------------------------------------------------------- 
[ERROR] BUILD FAILURE 
[INFO] ----------------------------------------------------------- 
[INFO] Required goal not found: dependency:list 

打电话给我一个充满希望的天真,但我曾希望maven会下载它没有的任何插件。有谁知道什么可能导致这个错误?有没有人知道maven商店在哪里安装了哪些插件以及它们存储在maven仓库中的信息?

+0

哪个Maven版本是这样吗?总是建议更新到最新和最好的。 – 2008-11-21 11:28:06

+0

Maven版本:2.0.7 Java版本:1.5.0_06 操作系统名称:“windows xp”版本:“5.1”arch:“x86” – izb 2008-11-21 11:31:08

回答

1

为了回答我自己的问题,感谢一些关于它的评论,settings.xml文件已经定制,并没有列出中央Maven仓库。

糟糕。

4

您是否试过mvn -cpu dependency:list(或:mvn --check-plugin-updates dependency:list)?也许,你有依赖插件的旧版本没有目标list

如果这没有帮助,请尝试升级Maven。由于Super POM为最重要的插件(包括依赖插件)提供了2.0.9的默认版本,因此将下载2.0版本(其目标为list)。

或者您可以尝试从存储库中删除缓存版插件(~/.m2/repository/org/apache/maven/plugins/maven-dependency-plugin/,其中~是用户主目录)。

0

尝试最新的maven版本,通常升级到新版本可以解决问题。

2

我已经从企业防火墙背后得到了一个类似的结果。您的配置(settings.xml)中的代理设置可能是答案。

<proxies> 
    <proxy> 
    <id>proxy</id> 
    <active>true</active> 
    <username>user</username> 
    <password>passwrd</password> 
    <protocol>http</protocol> 
    <host>example.proxy.name.com</host> 
    <port>80</port> 
</proxy> 
</proxies> 
1

许多Maven麻烦可以通过知道发布到论坛(回答许多后续问题的人发布上面的帖子)或邮件列表中的失败尝试的所有细节来解决,这是通过运行Maven调试和例外选项开关,像这样:mvn <yourgoal> -X -e

输出样本,然后将这个样子:

[~/Documents/Temp/Scratch] mvn clean -e -X 
Using Java version: 1.6 
+ Error stacktraces are turned on. 
Maven version: 2.0.9 
Java version: 1.6.0_07 
OS name: "mac os x" version: "10.5.6" arch: "x86_64" Family: "mac" 
[DEBUG] Building Maven user-level plugin registry from: '/Users/mccm06/.m2/plugin-registry.xml' 
[DEBUG] Building Maven global-level plugin registry from: '/Applications/Dev/apache-maven/conf/plugin-registry.xml' 
[INFO] Scanning for projects... 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Maven Default Project 
[INFO] task-segment: [clean] 
[INFO] ------------------------------------------------------------------------ 
[DEBUG] Retrieving parent-POM: org.apache.maven.plugins:maven-plugins::10 for project: null:maven-clean-plugin:maven-plugin:2.2 from the repository. 
[DEBUG] Retrieving parent-POM: org.apache.maven:maven-parent::7 for project: org.apache.maven.plugins:maven-plugins:pom:10 from the repository. 
[DEBUG] Retrieving parent-POM: org.apache:apache::4 for project: org.apache.maven:maven-parent:pom:7 from the repository. 
[INFO] ------------------------------------------------------------------------ 
[ERROR] BUILD ERROR 
[INFO] ------------------------------------------------------------------------ 
[INFO] Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one. 
[INFO] ------------------------------------------------------------------------ 
[DEBUG] Trace 
org.apache.maven.lifecycle.LifecycleExecutionException: Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one. 
     at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583) 
     at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499) 
     at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478) 
     at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330) 
     at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291) 
     at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142) 
     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336) 
     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129) 
     at org.apache.maven.cli.MavenCli.main(MavenCli.java:287) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
     at java.lang.reflect.Method.invoke(Method.java:597) 
     at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) 
     at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) 
     at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) 
     at org.codehaus.classworlds.Launcher.main(Launcher.java:375) 
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one. 
     at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:377) 
     at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558) 
     ... 16 more 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: < 1 second 
[INFO] Finished at: Mon Feb 16 10:59:39 MST 2009 
[INFO] Final Memory: 2M/7M 
[INFO] ------------------------------------------------------------------------ 
相关问题