On Mon, Mar 24, 2014 at 9:40 AM, mkarg <[email protected]> wrote: > We started using multi-module project for the first time and notice strange > behaviour. We hope that some experienced user can tell us how to proceed. > > There is one multi-module project where module 1 is dependend on module 2. > Module 1 uses assembly plugin in the package phase to produce the final > artifact (zip file). Modul 2 uses dependency plugin in the generate-source > phase to unpack that artifact (zip file). > > When we execute module 1 only (maven install) and after that module 2 > (maven > compile) all works well. > > When we execute the multi-module parent (maven compile) then it fails, > because the zip will not get bundled then obviously, so module 2 cannot > find > it. > > So how to tell maven that in a multi-module project, we want module 1 to > run > up to install but module 2 to run up to compile only?
You can't (though maybe with Maven 3.2.1 one could possibly build a Builder that would do that: http://takari.io/2014/03/20/how-maven-builds.html) > Or is it wanted by > desing that in a multi-module project we always must run to install phase > to > be sure that module 1 is done before module 2 starts? > > We hoped that a multi-module project would solve this automatically, i. e. > mvn compile on the parent shall notice that it must actuall do install but > not compile on module 1 as it is a dependency to module 2...! > IMO, you should never need to "mvn install" anything; particularly with a multi-module project. My rule of thumb is that you should only use ones of "mvn package" or "mvn verify" (and later "mvn deploy"), particularly when dealing with multi-module projects. Want to skip tests? add -DskipTests. Want to run only selected tests? (e.g. those from a single module) use -Dtest=my/test/pattern/* -Dsurefire.failIfNoSpecifiedTests (see http://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.htmland http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#test) -- Thomas Broyer /tɔ.ma.bʁwa.je/ <http://xn--nna.ma.xn--bwa-xxb.je/>
