I have three separate projects I am working on (A, B, and C).
Project B and C rely on a jar that project A generates.
Does Maven have the ability to automatically build project A if the dependency is not found?
The answers I’ve found so far are indicative of making the other 2 projects modules (which I believe to mean repository layout and incorporate them into project A) and create a parent / child pom.
A just plain “no” was also one of my conclusions as well.
It seems as though if I make a module of project A in B and C, maven doesn’t really like that. Can Maven see projects during build time that are outside of the scope of the current project? Sorry if that’s a little wordy.
The scenario works fine if A, B and C are modules of a common container project.
From root pom.xml:
where “project-a” etc. are names of maven project folders inside the parent folder.
The parent project must have
<packaging>pom</packaging>for this to work.Then you can build the parent project and it will build all children in order, or you can use one of the advanced Maven reactor flags.
e.g.
mvn clean install -pl project-bwill only build project B.For more info, execute
mvn --helpand read the multi modules chapter from the Maven By Example book.But to this question:
… the answer is always no. Maven fails if the dependency is not found, but it never decides which projects to build. You are in charge of which projects need building.