I am setting up a project in eclipse . This projects builds successfully through command line(all mvn
commands like mvn package
, mvn compile<
The following worked for me.
Just right-click on Project -> Maven -> Update Project...
such as it is shown here.
Make sure you're defining the dependency as close as possible to the leaf of the project tree where it is needed. Otherwise, Maven might ignore it.
For example, if you have a parent project that references projects A and B and the dependency is with respect to project A, then defining the dependency in the parent's pom.xml might get ignored by Maven. So, define it in project A's pom.xml.
Parent Project's pom.xml
Sub-project A's pom.xml <<< define the dependency where it is needed
Sub-project B's pom.xml
Sometimes there is an error downloading a dependency - eg. some files are downloaded but the actual JAR is missing from the local Maven repository.
In this case I had to delete the whole folder of the problematic dependency in the local maven repository. Only then did Maven update work (Right-click on the project and select Project > Maven > Update Project...
. )
In my case, I had unchecked Build automatically
. Checking it again started downloading the jars.
I had faced a similar issue and following the below steps helped me fix it.
Select the project
Right Click -> Maven
Update project..
It will download all the missing Jars.
I was facing similar sort of issue. I tried deleting folders inside .m2 and again building maven project.
I could download all dependency except one dependency which we have created by ourselves and published on Nexus.
Then I changed by java pointing from JRE to JDK which solved my problem