2016-12-28 4 views
1

java 멀티 프로젝트에서 EAR을 빌드하려고합니다. WAR 개의 프로젝트와이 프로젝트에서 복수 JAR 개의 프로젝트가 있습니다. 내가 프로젝트를 JAR의 모든 종속성을 만들 때 귀 LIB로 가져 및 WAR의 모든 종속성이 프로젝트는 lib에 해당 WEB-INF /로 가져옵니다. 그러나 모두 WAR 프로젝트는 많은 공통 종속성을 사용합니다. 이 모든 종속 관계로 인해 EAR이 매우 커집니다 (> 100MB). 모든 종속성을 하나의 EAR 파일에 추가하고 WAR 파일에는 하나도 포함하지 않는 방법이 있습니까? 전쟁 파일 종속성이있는 Gradle ear 빌드

내 build.gradle은 아래와 같습니다 EAR ..

apply plugin: 'ear' 
apply plugin: 'java' 


configurations { 
    earLib.extendsFrom runtime 
    earLib.transitive = true 
} 

description = 'JavaEE6 Assembly' 
dependencies { 
    deploy project(path: ':WAR1', configuration: 'archives') 
    deploy project(path: ':WAR2', configuration: 'archives') 
    deploy project(path: ':WAR3', configuration: 'archives') 

    earlib project(':CommonJAR1') 
    earlib project(':CommonJAR2') 

    // Writing as below does not work in this case 
    // earLib group: 'io.springfox', name: 'springfox-swagger2', version:'2.1.1' 
} 

ear { 
    archiveName='EARNAME.ear' 
    libDirName 'lib' 
    into("META-INF"){ 
     from("META-INF") 
    } 

} 

에 따라 내가 어떤 소스를 그 I를 시도

apply plugin: 'war' 


description = 'WAR2' 
dependencies { 
    compile project(':CommonJAR1') 
    compile group: 'commons-beanutils', name: 'commons-beanutils', version:'1.9.2' 
    compile group: 'org.springframework', name: 'spring-jdbc', version:'4.0.5.RELEASE' 
    compile group: 'org.springframework', name: 'spring-core', version:'4.0.5.RELEASE' 
    compile group: 'org.springframework', name: 'spring-beans', version:'4.0.5.RELEASE' 
    compile group: 'org.springframework', name: 'spring-webmvc', version:'4.0.5.RELEASE' 
    compile group: 'org.springframework', name: 'spring-oxm', version:'4.0.5.RELEASE' 
    compile group: 'org.springframework', name: 'spring-orm', version:'4.0.5.RELEASE' 
    compile group: 'org.springframework', name: 'spring-context-support', version:'4.0.5.RELEASE' 
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version:'2.2.3' 
    compile group: 'org.json', name: 'json', version:'20090211' 
    compile(group: 'org.springframework', name: 'spring-context', version:'4.0.5.RELEASE') { 
exclude(module: 'commons-logging') 
    } 
    compile group: 'org.aspectj', name: 'aspectjrt', version:'1.7.4' 
    compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.5' 
    compile(group: 'log4j', name: 'log4j', version:'1.2.15') { 
exclude(module: 'mail') 
exclude(module: 'jms') 
exclude(module: 'jmxtools') 
exclude(module: 'jmxri') 
    } 
    compile group: 'javax.inject', name: 'javax.inject', version:'1' 
    compile group: 'javax.servlet', name: 'jstl', version:'1.2' 
    runtime group: 'io.springfox', name: 'springfox-swagger2', version:'2.1.1' 
    runtime group: 'org.springframework', name: 'spring-web', version:'4.0.5.RELEASE' 
    runtime group: 'org.slf4j', name: 'jcl-over-slf4j', version:'1.7.5' 
    runtime group: 'org.slf4j', name: 'slf4j-log4j12', version:'1.7.5' 
    providedCompile group: 'javax.servlet', name: 'servlet-api', version:'2.5' 
    providedCompile group: 'javax.servlet.jsp', name: 'jsp-api', version:'2.1' 
} 

WAR 파일 build.gradle 중 하나입니다 같은 일을하는 것을 발견 할 수 있었지만 아무도 효과가 없었다. 제발 제안 해주세요. 프로젝트를 배포 할 때 WAS 8.5

답변