In an eclipse project, I referenced a class that was currently not in project's build path.
In the context sensitive pop-up that opens by hovering the mouse over the error, "Fix project setup" option has offered me to add a jar to the build path of the project. This jar is in my local maven repository.
However, the "correct" way to fix it is obviously by adding the relevant dependencies to my project's pom, instead of adding this jar to the build path of the project.
So is there a way to configure eclipse, so that it won't offer to add a maven repo jar to the build path, but it will offer to fix the project's pom?
Right-click on an error. Click on Quick Fix and search for the suggestion of importing a project or library.
Update Maven settings in Eclipse. Right-click your project and select Maven Update Project and update your project.
What does "Maven -> Update Project..." do in Eclipse? It just makes a refresh to reload the maven configuration file again.
My problem solved by right click on project -> Maven -> Update project. Then the Maven Dependencies appear on the project explore. Save this answer.
This feature used to exist in m2eclipse (the predecessor of m2e), see e.g. https://blog.sonatype.com/2010/03/adding-dependencies-using-m2eclipse/ which shows a "Search dependency for XXX" quickfix above the "Fix project setup..." quickfix.
Unfortunately it didn't make it into m2e, see https://www.eclipse.org/lists/m2e-users/msg01130.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With