Maven:无法解析依赖关系:C:\ Program Files \ Java \ lib \ tools.jar

时间:2011-10-22 14:48:18

标签: eclipse maven tools.jar

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

[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路径。

有什么想法吗?我已经研究了一段时间并对此感到疯狂。 including tools.jar as dependency上的文档对我没有帮助。

重要提示:这似乎可以在Eclipse之外使用,例如与mvn -P local cargo:start


从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开始):

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

1 个答案:

答案 0 :(得分:1)

你必须用jdk而不是jre开始eclipse。 如果您编辑eclipse.ini并将jdk放入vm参数,它应该可以工作。

-vm

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