Gradle ear is putting JAR instead of WAR

rascio picture rascio · Mar 12, 2013 · Viewed 9.8k times · Source

I'm trying to build an ear using Gradle.
I've my project tree like:

/project
|
|--> /web-application
|    |
|    |--> /src (stuff of web app)
|    |
|    |--> build.gradle
|
|--> build-gradle
|--> settings.gradle

I'm trying to generate the ear using the ear plugin, but when I do gradle assemble I have the war created under the build directory of the web-application, but inside the generated ear I have a jar of the web application. The gradle configuration files are very simple, here they are:

project/build.gradle

apply plugin: 'ear'

repositories {
    mavenCentral()
}

dependencies {
    deploy project(':web-application')
    earlib group: 'log4j', name: 'log4j', version: '1.2.15', ext: 'jar'
}

project/web-application/build.gradle

apply plugin: 'war'

repositories {
   mavenCentral()
}

dependencies {
    compile group: 'log4j', name: 'log4j', version: '1.2.15', ext: 'jar'
}

What I did wrong?

I notice that also the bundled samples for the war plugin, have the same problem... Thanks in advance

Answer

rascio picture rascio · Mar 12, 2013

SOLVED!

It needs to configure the WAR module inside the EAR project as:

dependencies {
    deploy project(path:':web-application', configuration:'archives')
    earlib group: 'log4j', name: 'log4j', version: '1.2.15', ext: 'jar'
}