The problem I'm experiencing is that eclipse can't resolve any of the dependencies of my project. This causes problems because even though the dependencies seem to work alright when coding (I get autocompletion) I still get a huge list of errors referring to missing artifacts.
When filtering these, I found the following:
The container 'Maven Dependencies' references non existing library '/home/[...]/.m2/repository/com/sun/tools/1.5.0/tools-1.5.0.jar'
It seems that this dependency was introduced by struts2, who have a profile set up as follows in their pom:
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
That systemPath resolves and so I don't see a reason why this would be causing trouble. In any case, is there a way to tell eclipse that this m2eclipse dependency is a system dependency that is not found in the local repository?
I had the same issue several times and I could fix it following two steps:
I could repeat the process several times successfully.
A more elegant solution (I haven't had the chance to try it yet), might be to clear m2eclipse caches mentioned at https://stackoverflow.com/a/16444984.
Hope this will help anyone.
I had this issue, but I have fixed by using the steps below:
Case1:
Eclipse by default pointing to JRE but eclipse maven plugin required JDK so point to JDK
change it to JDK
Follow the steps to change to JDK from JRE
Now I can build my project without any issue. Is this the correct way to solve this issue?
Just add this. It will work.
I was facing the same problem and needed to do the following things
It worked for me seamlessly.
Its worth to add that, in my
eclipse.ini
file I had to add the -vm ... lines at the top of the file. likeMake sure that, -vm option is placed before -vmargs as everything after -vmargs is passed directely to vm and selecting a particular is depend on -vm option.
excludes tools jar from the struts dependency.
Download http://repository.ops4j.org/maven2/tools/tools/1.5.0/ and put the jar in the
C:\Documents and Settings\Administrador\.m2\repository\com\sun\tools\1.5.0
. Good luck.