title: Run multiple war's with gradle and tomcat in NetBeans IDE
body: <p>I'm using NetBeans 8.0.2 IDE, gradle and tomcat 6.
  I've creates a root-project with some sub-projects:</p>
  
  <ul>
  <li>rootproject
  <ul>
  <li>frontend (war)</li>
  <li>rest (war)</li>
  <li>data (jar)</li>
  </ul></li>
  </ul>
  
  <p>What I want know is, deploy the rootproject (or frontend) and then deploy the frontend-war and rest-war to the embedded and local tomcat server.
  I tried the Cargo plugin with identifier <a href="https://github.com/bmuschko/gradle-cargo-plugin" rel="nofollow">com.bmuschko.cargo</a> but there's no way to configure it right, so it can run like i want.</p>
  
  <p>Some stuff on the internet says, that this isn't working well or isn't possible...</p>
  
  <p>Has anyone an idea, how to solve this?
  Should i use maven instead?</p>
  
  <p>Here are my configuration files:</p>
  
  <p><strong>Rootproject build.gradle:</strong></p>
  
  <pre><code>buildscript {
      repositories {
          jcenter()
      }
  
      dependencies {
          classpath 'com.bmuschko:gradle-cargo-plugin:2.0.3'
      }
  }
  
  
  import org.gradle.api.artifacts.*
  
  
  
  apply plugin: 'base' // To add "clean" task to the root project.
  apply plugin: 'com.bmuschko.cargo'
  
  subprojects { 
      apply from: rootProject.file('common.gradle')
  }
  
  task wrapper(type: Wrapper, description: 'Creates and deploys the Gradle wrapper to the current directory.') {
      gradleVersion = '2.1'
  }
  
  dependencies {
      def cargoVersion = '1.4.5'
      cargo "org.codehaus.cargo:cargo-core-uberjar:$cargoVersion",
            "org.codehaus.cargo:cargo-ant:$cargoVersion"
  }
  
  cargo {
      containerId = 'tomcat6x'
  
      deployable {
          file = project(':Frontend').war.archivePath
          context = 'frontend'
      }
  
      deployable {
          file = project(':Rest').war.archivePath
          context = 'rest'
      }
  
      local {
          homeDir = file('C:\\Program Files\\Apache Software Foundation\\Apache Tomcat 6.0.35')
      }
  }
  
  [cargoDeployRemote, cargoRunLocal]*.dependsOn project(':Frontend').war, project(':Rest').war
  </code></pre>
  
  <p><strong>Rootproject common.gradle:</strong></p>
  
  <pre><code>apply plugin: 'java'
  apply plugin: 'maven'
  
  String mavenGroupId = 'rootproject'
  String mavenVersion = '1.0-SNAPSHOT'
  
  sourceCompatibility = '1.8'
  [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
  
  repositories {
      mavenCentral();
      // You may define additional repositories, or even remove "mavenCentral()".
      // Read more about repositories here:
      //   http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:repositories
  }
  
  dependencies {
      // Adding dependencies here will add the dependencies to each subproject.
      testCompile group: 'junit', name: 'junit', version: '4.10'
  }
  
  String mavenArtifactId = name
  
  group = mavenGroupId
  version = mavenVersion
  
  task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
      classifier = 'sources'
      from sourceSets.main.allSource
  }
  
  artifacts {
      archives jar
      archives sourcesJar
  }
  
  configure(install.repositories.mavenInstaller) {
      pom.project {
          groupId = mavenGroupId
          artifactId = mavenArtifactId
          version = mavenVersion
      }    
  }
  
  task createFolders(description: 'Creates the source folders if they do not exist.') doLast {
      sourceSets*.allSource*.srcDirs*.each { File srcDir -&gt;
          if (!srcDir.isDirectory()) {
              println "Creating source folder: ${srcDir}"
              srcDir.mkdirs()
          }
      }
  }
  </code></pre>
  
  <p><strong>Frontend build.gradle:</strong></p>
  
  <pre><code>apply plugin: 'war'
  
  sourceCompatibility = 1.7
  targetCompatibility = 1.7
  
  if (!hasProperty('mainClass')) {
      ext.mainClass = ''
  }
  
  sourceSets {
      main {
          java {
              srcDir '/src/main/java'
          }
          resources {
              srcDir '/src/main/java'
              include '**/*.xml'
          }
      }
  }
  
  war {
      archiveName = 'Frontend.war'
      exclude('**/*.java,**/*.form')
  }
  
  dependencies {
      providedCompile 'javax.servlet:servlet-api:2.5',
                      'javax.servlet:jsp-api:2.0'
  
      compile project(':Data')
  
      compile 'antlr:antlr:2.7.6'
  }
  </code></pre>