Eclipse – Is any method to using “Workspace project” maven repository

eclipsem2eclipsemaven

We have: Eclipse 3.6, Maven (M2Eclipse), Two Project (ProjectA and ProjectB) with pom.xml.

ProjectB depends of ProjectA (using maven).

  1. If we install ProjectA to local repository (maven install), ProjectB resolve dependencies OK.

  2. If we not install ProjectA to local repository. In Maven POM Editor we add ProjectA as dependency of ProjectB (M2Eclipse using "workspace project" repository to resolve this dependency).

OK, added. But if we do "maven package" or others plugins goals… dependency not resolved.
And we have somethings like that:

Downloading: http://repo1.maven.org/maven2/Artifact/ProjectA/maven-metadata.xml

and of course it cannot be resolved.

Now is the Question. How I can use "Workspace project" when build ProjectB?

P.S. Why I'm not using "maven install"? OK, it is 100% method, but when I do many small changes in several it is too long do excess operations.

P.S.S. "Workspace project" we can see Window -> Show View -> Maven Repositories.

Best Answer

I think the idea of running the 'Maven package' or similar goals from Eclipse is to do whatever maven would have done if run from the commandline for example. The scenario that you are giving wouldn't have worked on the commandline either.

If project B depends on project A (via pom.xml) that means that project A should be available in a repository. Whether that's local (via mvn install) or remote via (mvn deploy) doesn't matter, but mvn package isn't enough. That will just put a package in the /target folder.

The only exception would be if both projects reside in the same reactor I suppose, that is both projects are modules of some other 'parent' project. In that case triggering maven targets on one of the submodules might be able to resolve the dependencies okay. Not 100% sure though.

Back to your question: "Now is the Question. How I can use "Workspace project" when build ProjectB?". No, I don't think so.