Is it possible / reasonable to use the gradle war and ears plugin in the same project?

I found that the ear plugin overrides the war plugin and prevents the war task from being invoked. I bypassed him by calling directly.

Is this remotely sensible or should I give up and go to 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")  
    }
}

      

+3


source to share


1 answer


The Ear plugin does not override the War plugin, it simply does not perform the task war

by default. Anyway, what you are trying to do is certainly possible. Instead of adding a dependency to a separate military project (as described in the documentation, you can simply depend on the task itself war

.



apply plugin: 'war'
apply plugin: 'ear'

dependencies {
    deploy files(war)
}   

      

+4


source







All Articles