Put root resulting jar intro subproject war


(c1351271) #1

So - correctly I something like this build script.

// Syntax for creating additional properties
ext {
    // List containing commons libs
    commons_libs = ["commons-fileupload:commons-fileupload:1.2",
            "commons-io:commons-io:1.2",
            "commons-logging:commons-logging:1.1.1",
            "commons-codec:commons-codec:1.4"
    ]
      httpcomponents_libs = ["org.apache.httpcomponents:httpclient-cache:4.1",
            "org.apache.httpcomponents:httpcore:4.1",
            "org.apache.httpcomponents:httpmime:4.1"
    ]
      tomcat_libs = ["org.apache.tomcat:tomcat-catalina:7.0.39",
            "org.apache.tomcat:tomcat-util:7.0.39",
            "org.apache.tomcat:tomcat-juli:7.0.39",
            "org.apache.tomcat:tomcat-api:7.0.39",
            "org.apache.tomcat:tomcat-annotations-api:7.0.39",
            "org.apache.tomcat:tomcat-servlet-api:7.0.39",
            "org.apache.tomcat:tomcat-coyote:7.0.39"]
  }
    // For all projects in global project.
allprojects {
    apply plugin: 'java'
    apply plugin: 'maven'
      version = '0.4'
          repositories {
        mavenCentral()
    }
      dependencies {
        compile commons_libs
           compile httpcomponents_libs
          compile "mysql:mysql-connector-java:5.1.+"
        compile "org.littleshoot:dnsjava:2.1.3"
          testCompile "junit:junit:4.11"
    }
}
  // This params are set only for erpscan-server project.
project(':our_root_project_that_we_cannot_touch') {
    apply plugin: 'war'
          // We have non maven project structure, so setting currect roots for each set.
    sourceSets.main.java.srcDirs = ['src', 'anotherSrc']
    sourceSets.test.java.srcDirs = []
          // Resources are not used.
    sourceSets.main.resources.srcDirs = []
    sourceSets.test.resources.srcDirs = []
      dependencies {
           providedCompile tomcat_libs
        providedCompile httpcomponents_libs
        providedCompile commons_libs
          providedCompile "mysql:mysql-connector-java:5.1.+"
        providedCompile "org.littleshoot:dnsjava:2.1.3"
             }
      war {
        from './web'
        archiveName 'ROOT.war'
    }
  }
  // We have non maven project structure, so setting currect roots for each set.
 sourceSets.main.java.srcDirs = ['src']
sourceSets.test.java.srcDirs = ['tests']
  // Resources are not used.
sourceSets.main.resources.srcDirs = []
sourceSets.test.resources.srcDirs = []
    // Defining check code
dependencies {
    compile project(':our_root_project_that_we_cannot_touch')
  }

I want to be able to put resulting root jar into “our_root_project_that_we_cannot_touch” subproject war. Can anybody help with this?


(Peter Niederwieser) #2

That would be ‘dependencies { compile project(":") }’, but you cannot have a dependency in both ways.