Konrad R
Konrad R

Reputation: 75

Could not resolve dependencies for maven project

I've got this kind of error when I try to run my app in Eclipse.

    Failed to execute goal on project. Could not resolve dependencies for project pl.wyk:Game-Logic:war:0.0.1-SNAPSHOT: Could not find artifact com.sun:tools:jar:1.8.0_45 at specified path C:\java\jdk/../lib/tools.jar.

But when I try run app from console everything is fine. So what is wrong with Eclipse? I use this same external Maven Runtime.

Upvotes: 1

Views: 1247

Answers (2)

Konrad R
Konrad R

Reputation: 75

The problem was with Alternate JRE. You need to choose proper path. In my case:

 C:\java\jdk\jre

Upvotes: 0

Garry
Garry

Reputation: 4533

Try to add your system JDK as Library in Eclipse and use it for the project.

If this doesn't work then you may have to add scope dependency but may cause portability issues:

<dependency>  
    <groupId>com.sun</groupId>  
    <artifactId>tools</artifactId>  
    <version>1.6</version>  
    <scope>system</scope>  
    <systemPath>${java.home}/../lib/tools.jar</systemPath>  
</dependency> 

Upvotes: 1

Related Questions