问题
In theory, enabling Workspace resolution should make Eclipse to use the current project rather to go to the repository.
But it may fail, for different reasons. In my case, two projects A and A-test. Both of them have
- many subprojects/modules
- a main pom.xml that mentions such modules
I imported all of them in the same workspace.
Now, when running project in A-test, the only way to see the effect of a change in A is do a mvn install
, so the jar is updated in local repository.
Enabling workspace resolution wasn't helping. Although, it sort of works when Debugging from Eclipse. A real mess.
So, how can I make sure projects in A-test are looking at Eclipse's A?
回答1:
It seems the workspace resolution is not exact. When projects are related through a common/global pom.xml, it seems to work.
So, in my case, per project in A-test, I did
- Right click, Build Path, Config Build path
- Tab "Projects": add all the A projects (in my case, that's safe)
- Tab "Order and Export": make sure A projects are BEFORE projects in M2. I just move all the A projects to top.
Now, when I ran a project in A-test, it's looking at A.
NB: - Eclipse Oxygen - A does not depends on A-test, at all.
来源:https://stackoverflow.com/questions/50105371/how-make-eclipse-uses-maven-projects-even-if-workspace-resolution-is-not-working