Removing WAR from published artifacts in multi-project EAR build


(james.carnegie) #1

I have a normal EAR build using the EAR plugin in Gradle 1.6.

build.gradle
->ear
--->build.gradle
->war
--->build.gradle

The ear build.gradle contains this:

dependencies {
    deploy project(path: ':war',configuration:'archives')
    compile project(path: ':war', configuration:'providedCompile')
}

Because the EAR contains the WAR (these two always have the same lifecycle in this project), I don’t want to publish the WAR as part of the build, but the WAR plugin seems to add the war to “artifacts”.

Is there any way to prevent this from happening?


(Luke Daley) #2

The simplest solution would be to disable the uploadArchives task of the war project…

war/build.gradle:

uploadArchives.enabled = false

(james.carnegie) #3

Perfect! I’ve hunted high and low for this. Thank so much.


(Luke Daley) #4

You’re most welcome.