Maven: Failed to resolve dependency: C:\Program Files\Java\lib\tools.jar

1.1k views Asked by At

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]

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.

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.

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


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

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

There are 1 answers

0
kiwilisk On

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