Search code examples
eclipsemavenm2eclipse

m2eclipse: automatic Maven install upon build of dependencies


I have a feeling I'm missing something very basic. Usually such feelings turn out to be justified. I am not very well-versed with Maven so bear with me please.

Using Eclipse Juno and m2eclipse, with an external Maven 3.0.4 install. I have two projects, A and B. Project A depends on project B for compilation. Both projects are packaging=jar. Simple.

Now, I right-click project A and choose Run As -> Maven install. This results in an error, with Maven telling me that it couldn't find project B in the repository.

Makes sense. Project B isn't in the repository. However, I would expect m2eclipse to detect that, and perform mvn install on B before attempting A.

This doesn't happen. mvn install on project A assumes that project B is already in my local repository. I have workspace resolution turned on.

What gives?


Solution

  • You can add a parent project to A&B. Run 'mvn install -pl A -am' on parent project, and project B will be made (install) before project A.