title: Deploy a multi-module project with Maven Cargo
body: <p>In this project I'm working on, I have a big master pom file defining several modules (domain, dao, service, war).</p>
  
  <p>I want to deploy my war to my remote tomcat server using Cargo.</p>
  
  <p>running mvn cargo:deploy -Ptest however gives me an error that the dependency for the module domain in the module dao could not be resolved.</p>
  
  <p>I've tried putting the cargo config in the war pom but still the same.</p>
  
  <p>Can someone help me?</p>
  
  <p>This is the parent 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/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.domain&lt;/groupId&gt;
      &lt;artifactId&gt;product&lt;/artifactId&gt;
      &lt;version&gt;1.2-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
  
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;
              &lt;!-- Internal dependencies --&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;com.domain.product&lt;/groupId&gt;
                  &lt;artifactId&gt;product-domain&lt;/artifactId&gt;
                  &lt;version&gt;${project.version}&lt;/version&gt;
                  &lt;type&gt;jar&lt;/type&gt;
                  &lt;scope&gt;compile&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;com.domain.product.dao&lt;/groupId&gt;
                  &lt;artifactId&gt;product-dao-api&lt;/artifactId&gt;
                  &lt;version&gt;${project.version}&lt;/version&gt;
                  &lt;type&gt;jar&lt;/type&gt;
                  &lt;scope&gt;compile&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;com.domain.product.dao&lt;/groupId&gt;
                  &lt;artifactId&gt;product-dao-jpa2&lt;/artifactId&gt;
                  &lt;version&gt;${project.version}&lt;/version&gt;
                  &lt;type&gt;jar&lt;/type&gt;
                  &lt;scope&gt;compile&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;com.domain.product.service&lt;/groupId&gt;
                  &lt;artifactId&gt;product-service-api&lt;/artifactId&gt;
                  &lt;version&gt;${project.version}&lt;/version&gt;
                  &lt;type&gt;jar&lt;/type&gt;
                  &lt;scope&gt;compile&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;com.domain.product.service&lt;/groupId&gt;
                  &lt;artifactId&gt;product-service-impl&lt;/artifactId&gt;
                  &lt;version&gt;${project.version}&lt;/version&gt;
                  &lt;type&gt;jar&lt;/type&gt;
                  &lt;scope&gt;compile&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;com.domain.product&lt;/groupId&gt;
                  &lt;artifactId&gt;product-war&lt;/artifactId&gt;
                  &lt;version&gt;${project.version}&lt;/version&gt;
                  &lt;type&gt;jar&lt;/type&gt;
                  &lt;type&gt;war&lt;/type&gt;
                  &lt;scope&gt;compile&lt;/scope&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  
      &lt;build&gt;
          &lt;pluginManagement&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.codehaus.cargo&lt;/groupId&gt;
                      &lt;artifactId&gt;cargo-maven2-plugin&lt;/artifactId&gt;
                      &lt;version&gt;1.2.0&lt;/version&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/pluginManagement&gt;
      &lt;/build&gt;
  
      &lt;!-- profiles --&gt;
      &lt;profiles&gt;
          &lt;profile&gt;
              &lt;id&gt;test&lt;/id&gt;
              &lt;activation&gt;
              &lt;property&gt;
                  &lt;name&gt;environment.type&lt;/name&gt;
                  &lt;value&gt;test&lt;/value&gt;
              &lt;/property&gt;
              &lt;/activation&gt;
              &lt;properties&gt;
              &lt;/properties&gt;
          &lt;/profile&gt;
      &lt;/profiles&gt;
  
      &lt;modules&gt;
          &lt;module&gt;product-domain&lt;/module&gt;
          &lt;module&gt;product-dao-api&lt;/module&gt;
          &lt;module&gt;product-dao-jpa2&lt;/module&gt;
          &lt;module&gt;product-service-api&lt;/module&gt;
          &lt;module&gt;product-service-impl&lt;/module&gt;
          &lt;module&gt;product-war&lt;/module&gt;
      &lt;/modules&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>This is the WAR 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/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;artifactId&gt;product&lt;/artifactId&gt;
          &lt;groupId&gt;com.domain&lt;/groupId&gt;
          &lt;version&gt;1.2-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
      &lt;groupId&gt;com.domain.product&lt;/groupId&gt;
      &lt;artifactId&gt;product-war&lt;/artifactId&gt;
      &lt;name&gt;product&lt;/name&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.domain.product.service&lt;/groupId&gt;
              &lt;artifactId&gt;product-service-impl&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.domain.product.service&lt;/groupId&gt;
              &lt;artifactId&gt;product-service-api&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;profiles&gt;
          &lt;profile&gt;
              &lt;id&gt;test&lt;/id&gt;
              &lt;activation&gt;
                  &lt;property&gt;
                      &lt;name&gt;environment.type&lt;/name&gt;
                      &lt;value&gt;test&lt;/value&gt;
                  &lt;/property&gt;
              &lt;/activation&gt;
              &lt;properties&gt;
                  &lt;!-- Deployment settings --&gt;
                  &lt;cargo.containerId&gt;tomcat7x&lt;/cargo.containerId&gt;
                  &lt;cargo.baseurl&gt;http://test.domain.net:8080&lt;/cargo.baseurl&gt;
                  &lt;container.url&gt;${cargo.baseurl}/manager/text&lt;/container.url&gt;
                  &lt;container.user&gt;tomcat-txt&lt;/container.user&gt;
                  &lt;container.password&gt;password&lt;/container.password&gt;
                  &lt;container.pingurl&gt;${cargo.baseurl}/${project.name}/index.html&lt;/container.pingurl&gt;
              &lt;/properties&gt;
              &lt;build&gt;
                  &lt;plugins&gt;
                      &lt;plugin&gt;
                          &lt;groupId&gt;org.codehaus.cargo&lt;/groupId&gt;
                          &lt;artifactId&gt;cargo-maven2-plugin&lt;/artifactId&gt;
                          &lt;configuration&gt;
                              &lt;wait&gt;true&lt;/wait&gt;
                              &lt;container&gt;
                                  &lt;containerId&gt;${cargo.containerId}&lt;/containerId&gt;
                                  &lt;type&gt;remote&lt;/type&gt;
                              &lt;/container&gt;
                              &lt;configuration&gt;
                                  &lt;type&gt;runtime&lt;/type&gt;
                                  &lt;properties&gt;
                                      &lt;cargo.remote.uri&gt;${container.url}&lt;/cargo.remote.uri&gt;
                                      &lt;cargo.remote.username&gt;${container.user}&lt;/cargo.remote.username&gt;
                                      &lt;cargo.remote.password&gt;${container.password}&lt;/cargo.remote.password&gt;
                                  &lt;/properties&gt;
                              &lt;/configuration&gt;
                              &lt;deployer&gt;
                                  &lt;deployables&gt;
                                      &lt;deployable&gt;
                                          &lt;groupId&gt;com.domain.product&lt;/groupId&gt;
                                          &lt;artifactId&gt;product-war&lt;/artifactId&gt;
                                          &lt;type&gt;war&lt;/type&gt;
                                          &lt;properties&gt;
                                              &lt;context&gt;${project.name}&lt;/context&gt;
                                          &lt;/properties&gt;
                                          &lt;pingURL&gt;${container.pingurl}&lt;/pingURL&gt;
                                      &lt;/deployable&gt;
                                  &lt;/deployables&gt;
                              &lt;/deployer&gt;
                          &lt;/configuration&gt;
                      &lt;/plugin&gt;
                  &lt;/plugins&gt;
              &lt;/build&gt;
          &lt;/profile&gt;
      &lt;/profiles&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>As you can see, the war is dependent from the service, which by itself is dependent from the dao and that one from the domain.</p>