1

Given

   <modules>
      <module>A</module>
      <module>B</module>
    </module>
   </modules>

in a parent pom.xml. And in B/pom.xml

    <dependency>
        <groupId>foo.bar</groupId>
        <artifactId>A</artifactId>
    </dependency>

Then - what is the process here? It feels "wrong" to need to do

   mvn -pl A  clean package install 

and then

   mvn  -pl B clean package

in order to get the A dependency of B available before building the latter. It seems maven should know how to sort this out. What am I missing?

Update In response to (good) questions from @Tunaki

Both A and B have :

<parent>
    <groupId>org.myco.mypkg</groupId>
    <artifactId>parent</artifactId>
    <version>1.0.0</version>
</parent>

And the GAV is correct for A and also correctly referenced in B

<groupId>org.myco.mypkg</groupId>
<artifactId>A</artifactId>
<name>Name of A</name>
<version>1.0.0</version>
WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
  • I don't understand. Maven already sorts this correctly with just running `mvn clean install` from the parent project. Refer to http://stackoverflow.com/questions/33131880/maven-multi-module-project-cannot-find-sibling-module – Tunaki Mar 05 '17 at 20:27
  • @Tunaki So it appears the issue were that i had done only `mvn clean package` ? There is a related issue: `Intellij` "rebuild project" only does `mvn clean package` not `mvn package install` .. So i will need to remember only to perform that from command line. – WestCoastProjects Mar 05 '17 at 20:33
  • No, `clean package` or `clean install` should both work. But make sure your multi-module project is really correct, i.e.: each module inherit the parent, and the GAV coordinates used in the dependency are the right ones. – Tunaki Mar 05 '17 at 20:35
  • @Tunaki I double checked and seems things correct: updated OP. – WestCoastProjects Mar 05 '17 at 20:45

0 Answers0