Separate EARs pull in same dependencies


(Gary Collins) #1

Hi,

My gradle build consists of a build.gradle file and 2 separate gradle files (ear1.gradle and ear2.gradle).

The 2 EAR gradle files have a task each to build an EAR and separate dependencies.

The EARs are built separately but they both contain each others dependencies.

Any tips how I can build 2 EARs but with a set of separate dependecies ?

Thanks & Rgds

File 1:

apply plugin: ‘ear’

dependencies {
deploy project(’:some-ejb’)
deploy project(’:some_other-ejb’)
deploy project(path: ‘:some.war’, configuration: ‘archives’)
}

task myEar(type: Ear) {
classifier = 'xyz’
manifest { attributes ‘Dependencies’: ‘com.some.api export’ }
}

File 2:

apply plugin: ‘ear’

dependencies {
deploy project(’:xyz-ejb’)
deploy project(’:some_other_xyz-ejb’)
deploy project(path: ‘:some_xyz.war’, configuration: ‘archives’)
}

task myEar(type: Ear) {
classifier = 'xyz2’
manifest { attributes ‘Dependencies’: ‘com.some.api export’ }
}

build.gradle file:

apply from: ear1.gradle
apply from: ear2.gradle

dependencies {
earlib 'com.google.guava:guava’
earlib 'org.jboss
}

// some other tasks here