This is a classic example of how maven handles its artifacts. And the
key to explain this behavior is the local repository.
When you build your multiproject for the first time, what happens is
maven will build jar1 first and update your local repository copy since
jar2 depends on it. Then
I have the following structure where JAR2 depends on JAR1.
Parent
|- pom.xml
|
|- JAR1
| |- pom.xml
|
|
|- JAR2
| |- pom.xml
The JAR1 and JAR2 projects are developed concurrently, and pom.xml of JAR2
lists JAR1 as a dependency.
The parent pom.xml lists JAR1 and JAR2 as modules.
All