title: How to build a multi-module maven project in jenkins
body: <p>I have a projects structure as follows:</p>
  
  <pre><code>ProjectParent
   - pom.xml
   ProjectApp
     -pom.xml
   ProjectAPI
     -pom.xml
   ProjectModels
     -pom.xml
   ProjectServices
     -pom.xml
   Etc..
  </code></pre>
  
  <p><code>ProjectModels/ProjectsServices</code> are dependencies within <code>ProjectAPI/ProjectApp</code>.</p>
  
  <ol>
  <li><p>Should I create separate jobs within Jenkins to build each module separately?</p></li>
  <li><p>I created a job for <code>ProjectAPP</code> but get the following error below (Have set goals and actions to "clean install":</p></li>
  </ol>
  
  <blockquote>
    <p>[INFO] Scanning for projects...
        [INFO]<br>
        [INFO] ------------------------------------------------------------------------
        [INFO] Building myproject-app 0.0.1-SNAPSHOT
        [INFO] ------------------------------------------------------------------------</p>
  
  <pre><code>Downloading: http://maven.springframework.org/snapshot/com/myproject/myproject-common-config/0.0.1-SNAPSHOT/myproject-common-config-0.0.1-SNAPSHOT.pom
  [WARNING] The POM for com.myproject:myproject-common-config:jar:0.0.1-SNAPSHOT is missing,
  </code></pre>
    
    <p>no dependency information available
        Downloading: <a href="http://maven.springframework.org/snapshot/com/myproject/myproject-entities/0.0.1-SNAPSHOT/myproject-entities-0.0.1-SNAPSHOT.pom" rel="nofollow noreferrer">http://maven.springframework.org/snapshot/com/myproject/myproject-entities/0.0.1-SNAPSHOT/myproject-entities-0.0.1-SNAPSHOT.pom</a>
        [WARNING] The POM for com.myproject:myproject-entities:jar:0.0.1-SNAPSHOT is missing, no
    dependency information available
        Downloading: <a href="http://maven.springframework.org/snapshot/com/myproject/myproject-services/0.0.1-SNAPSHOT/myproject-services-0.0.1-SNAPSHOT.pom" rel="nofollow noreferrer">http://maven.springframework.org/snapshot/com/myproject/myproject-services/0.0.1-SNAPSHOT/myproject-services-0.0.1-SNAPSHOT.pom</a>
        [WARNING] The POM for com.myproject:myproject-services:jar:0.0.1-SNAPSHOT is missing, no
    dependency information available
        Downloading: <a href="http://maven.springframework.org/snapshot/com/myproject/myproject-persistence/0.0.1-SNAPSHOT/myproject-persistence-0.0.1-SNAPSHOT.pom" rel="nofollow noreferrer">http://maven.springframework.org/snapshot/com/myproject/myproject-persistence/0.0.1-SNAPSHOT/myproject-persistence-0.0.1-SNAPSHOT.pom</a>
        [WARNING] The POM for com.myproject:myproject-persistence:jar:0.0.1-SNAPSHOT is missing, no
    dependency information available
        Downloading: <a href="http://maven.springframework.org/snapshot/com/myproject/myproject-common-config/0.0.1-SNAPSHOT/myproject-common-config-0.0.1-SNAPSHOT.jar" rel="nofollow noreferrer">http://maven.springframework.org/snapshot/com/myproject/myproject-common-config/0.0.1-SNAPSHOT/myproject-common-config-0.0.1-SNAPSHOT.jar</a>
        ......
        org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project myproject-app: Could not resolve dependencies
    for project com.myproject:myproject-app:war:0.0.1-SNAPSHOT: The
    following artifacts could not be resolved:
    com.myproject:myproject-common-config:jar:0.0.1-SNAPSHOT,
    com.myproject:myproject-entities:jar:0.0.1-SNAPSHOT,
    com.myproject:myproject-services:jar:0.0.1-SNAPSHOT,
    com.myproject:myproject-persistence:jar:0.0.1-SNAPSHOT: Could not find
    artifact com.myproject:myproject-common-config:jar:0.0.1-SNAPSHOT in
    org.springframework.maven.snapshot
    (<a href="http://maven.springframework.org/snapshot" rel="nofollow noreferrer">http://maven.springframework.org/snapshot</a>)</p>
  </blockquote>
  
  <p><br/>
  ProjectParent Pom</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.myproject&lt;/groupId&gt;
      &lt;artifactId&gt;myproject-parent&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
  
      &lt;modules&gt;
          &lt;module&gt;myproject-entities&lt;/module&gt;
          &lt;module&gt;myproject-services&lt;/module&gt;
          &lt;module&gt;myproject-persistence&lt;/module&gt;
          &lt;module&gt;myproject-app&lt;/module&gt;
          &lt;module&gt;myproject-merchant&lt;/module&gt;
          &lt;module&gt;myproject-common-config&lt;/module&gt;
          &lt;module&gt;myproject-api&lt;/module&gt;
      &lt;/modules&gt;
  
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;
              ...
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  
      &lt;repositories&gt;      
          ...
      &lt;/repositories&gt;
  
      &lt;build&gt;
          ...
      &lt;/build&gt;
  
      &lt;properties&gt;
          ...
  
          &lt;myproject-entities-version&gt;0.0.1-SNAPSHOT&lt;/myproject-entities-version&gt;
          &lt;myproject-services-version&gt;0.0.1-SNAPSHOT&lt;/myproject-services-version&gt;
          &lt;myproject-persistence-version&gt;0.0.1-SNAPSHOT&lt;/myproject-persistence-version&gt;
      &lt;/properties&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p><br/>
  ProjectApp Pom</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;project
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
      xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;groupId&gt;com.myproject&lt;/groupId&gt;
          &lt;artifactId&gt;myproject-parent&lt;/artifactId&gt;
          &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;artifactId&gt;myproject-app&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
  
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;myproject-app&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
  
      &lt;dependencies&gt;
  
          ...
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.myproject&lt;/groupId&gt;
              &lt;artifactId&gt;myproject-common-config&lt;/artifactId&gt;
              &lt;version&gt;${myproject-common-config}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.myproject&lt;/groupId&gt;
              &lt;artifactId&gt;myproject-entities&lt;/artifactId&gt;
              &lt;version&gt;${myproject-entities-version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.myproject&lt;/groupId&gt;
              &lt;artifactId&gt;myproject-services&lt;/artifactId&gt;
              &lt;version&gt;${myproject-services-version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.myproject&lt;/groupId&gt;
              &lt;artifactId&gt;myproject-persistence&lt;/artifactId&gt;
              &lt;version&gt;${myproject-persistence-version}&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
  
          &lt;myproject-common-config&gt;0.0.1-SNAPSHOT&lt;/myproject-common-config&gt;
          &lt;myproject-entities-version&gt;0.0.1-SNAPSHOT&lt;/myproject-entities-version&gt;
          &lt;myproject-services-version&gt;0.0.1-SNAPSHOT&lt;/myproject-services-version&gt;
          &lt;myproject-persistence-version&gt;0.0.1-SNAPSHOT&lt;/myproject-persistence-version&gt;
      &lt;/properties&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p><br/>
  Am I using the wrong goals? Do I need to chain a number of commands? i.e. build other modules first?</p>
  
  <p>I'm using Maven 3.</p>
  
  <p>NOTE: I changed the target to "clean install" against the ParentProject Pom and everything builds correctly.</p>
  
  <p>Thanks</p>