Missing Maven dependencies in Eclipse project
Solution 1:
Well, I tried everything posted here, unfortunately nothings works in my case. So, trying different combinations I came out with this one that solved my problem.
1) Open the .classpath file at the root of your eclipse's project.
2) Insert the following entry to the file:
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
Then, rebuild your project at eclipse (Project->Clean-Build). You now can check at the Java Build Path of you project at the Libraries tab the Maven Dependencies included:
Solution 2:
Problem solved!
I don't know what exactly solved it, but I did 4 things in Eclipse:
- Window->Preferences: Maven->Installations: Global settings -> open file and hardcoded localRepository
- Project->Clean
- right click on project: Maven->Update dependencies
- right click on project: Maven->Update project configuration
I guess it was the Update dependencies since right after first two there were no change.
Solution 3:
I'm also new to Eclipse, and I've been having a similar problem where Eclipse just won't recognize an import statement, even though all signs point to the dependency having been successfully downloaded.
You should check that your dependency file has actually been downloaded by going to the command line and typing
mvn dependency:tree
If you see your package there, then but Eclipse doesn't acknowledge it, the thing that works for me (sometimes) is to go to the terminal, cd into the project folder, and type
mvn eclipse:clean
then
mvn eclipse:eclipse
Finally refresh project in eclipse
I don't know why this works, and sometimes it doesn't work once, then doing it again does work... so worth a try!
Solution 4:
I had this issue for dependencies that were created in other projects. Downloaded thirdparty dependencies showed up fine in the build path, but not a library that I had created.
SOLUTION:
In the project that is not building correctly,
Right-click on the project and choose Properties, and then Maven.
Uncheck the box labeled "Resolve dependencies from Workspace projects"
Hit Apply, and then OK.
Right-click again on your project and do a Maven->Update Snapshots (or Update Dependencies)
And your errors should go away when your project rebuilds (automatically if you have auto-build enabled).
Solution 5:
My Project was just screwed up. Here is how I fixed it for Eclipse Indigo x64 (J2EE 3.7.3):
- Deleted my POM file (backedup of course).
- Project Context Menu > Maven > Disable Maven Nature.
- Deleted the project (but not contents on disk).
- Re-imported as Import > General > Existing Project.
- Project Context Menu > Configure > Convert to Maven Project....
- Accept defaults from Maven wizard.
- Overwrite POM with your backedup POM. (Now you have Maven Dependencies folder).
- Maven Update/Clean for good measure.
Hope that helps someone. :)