Reputation: 793
I found that the ear plugin overrides the war plugin and prevents the war task being called. I got around it by calling it directly.
Is this remotely sensible or should I give up and move to a multi-project setup in eclipse and gradle?
ear {
doFirst {
println " - force build war..."
tasks.war.execute()
}
from("$destinationDir") {
exclude('nz')
rename ('TrialApp(.*)(.war)', 'TrialApp.war')
include 'TrialApp*.war'
into('')
}
deploymentDescriptor {
applicationName = "trialapp"
initializeInOrder = true
displayName = "Trial App"
description = "Trial App EAR for Gradle documentation"
libraryDirectory = "WEB-INF/lib"
webModule("TrialApp.war", "TrialApp")
}
}
Upvotes: 3
Views: 2113
Reputation: 13476
The Ear plugin doesn't override the War plugin, it simply doesn't execute the war
task by default. Anyway, what you are trying to do is certainly possible. Instead of adding a dependency to a separate war project (as is described in the documentation you can simply depend on the war
task itself.
apply plugin: 'war'
apply plugin: 'ear'
dependencies {
deploy files(war)
}
Upvotes: 5