Maven:无法解析依赖关系:C:\Program Files\Java\lib\tools.jar [英] Maven: Failed to resolve dependency: C:\Program Files\Java\lib\tools.jar

查看:1005
本文介绍了Maven:无法解析依赖关系:C:\Program Files\Java\lib\tools.jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用货物插件从Eclipse内部的本地Jetty容器中运行Web应用程序。这似乎适用于具有完全相同的pom.xml的其他人,但是我收到以下错误:

I'm trying to use the cargo plugin to run a web application in a local Jetty container from inside Eclipse. This seems to be working for other people with the exact same pom.xml, but I get this error:

[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.0.3:start (default-cli) on project wsc: Failed to resolve dependency: C:\Program Files\Java\lib\tools.jar -> [Help 1]

我该如何解决?该项目设置为使用jdk1.7.0作为JRE系统库。我使用-vm启动Eclipse,甚至将JAVA_HOME设置为JDK路径。

How do I resolve this? The project is set to use jdk1.7.0 as the "JRE System Library". I am starting Eclipse with "-vm " and even JAVA_HOME is set to the JDK path.

任何想法?我一直在研究一段时间,并对此感到疯狂。 将tools.jar作为依赖关系的文档没有帮助我。

Any ideas? I've been researching on this for a while and getting crazy about that. The documentation on including tools.jar as dependency didn't help me.

重要提示:这似乎在Eclipse之外工作,例如与 mvn -P本地货物:开始

Important: This seems to work outside Eclipse, e.g. with mvn -P local cargo:start.

程序输出从Eclipse开始时:

Program output when started from Eclipse:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Web Services Computing 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- cargo-maven2-plugin:1.0.3:start (default-cli) @ wsc ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.324s
[INFO] Finished at: Sat Oct 22 19:10:18 CEST 2011
[INFO] Final Memory: 15M/107M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.0.3:start (default-cli) on project wsc: Failed to resolve dependency: C:\Program Files\Java\lib\tools.jar -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException






依赖树输出(也从Eclipse开始):


Dependency tree output (also started from Eclipse):

[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ wsc ---
[INFO] de.tum.ibis.wsc:wsc:war:0.0.1-SNAPSHOT
[INFO] +- junit:junit:jar:3.8.1:test
[INFO] \- javax.servlet:servlet-api:jar:2.5:compile
[INFO] ------------------------------------------------------------------------


推荐答案

你必须用jdk启动eclipse而不是jre。
如果你编辑你的eclipse.ini并把一个jdk放在vm参数中,它应该可以工作。

You have to start eclipse with a jdk instead of a jre. If you edit your eclipse.ini and put a jdk to the vm arguments it should work.

-vm

C:/java_1_6/jdk/bin/javaw.exe

这篇关于Maven:无法解析依赖关系:C:\Program Files\Java\lib\tools.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆