How can I reference another workspace project using Eclipse m2e?
Do I have to add a project dependency in the project setting? But in that case the dependency is not shown in the pom.
If I set them in the pom, it will not reference the project in workspace but reference the jar in the local repository. Quite annoying, anyone can help?
If workspace resolution is disabled, the Maven build for project-a will only succeed if project-b 's artifact is present in the local repository. If workspace resolution is enabled, Maven will resolve the dependency via the MyEclipse workspace.
The correct way to do this is the following:
This should solve your problem. If after this, your dependencies are still referenced from the file system, check the groupId, artifactId and especially version of each dependency again.
Also check if you don't have any errors in your project - try to run Maven install.
I'd go even further than this. If you've ever run mvn eclipse:eclipse
on your project then you're probably in trouble. I had a situation where I had both a "Referenced Libraries" section and a "Maven Dependencies" section in my eclipse project, with conflicting library versions, causing eclipse and myself inevitable confusion.
The safest thing I found was to run mvn eclipse:clean
from the command line then go back in to eclipse, refresh the project, "OK" the resulting problem dialog, and then go Maven > Update Project. This sorted it all out for me.
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