Gradle 3.5 EAR plugin causes duplicate?

plugins

#1

I tried to package an ear application using Gradle 3.5 EAR plugin. The issue I encounter is it put ProjectWeb.war in ROOT AND lib/ProjectWeb.war

build.gradle

apply plugin: 'ear'
dependencies { 
    deploy   project(path: ':Project Web', configuration: 'archives')
    deploy   project(path: ':Project EJB', configuration: 'archives')
}

EAR Structure

Project Web.war
Project EJB.jar
META-INF
    application.xml
    MANIFEST.MF
lib
    ProjectWeb.war (same from Root)
    ProjectEJB.jar

Is this the behavior we expected OR I’ve missed something here?

Based on the Gradle Build Tool 3.5 docs

“The Ear plugin adds two dependency configurations: deploy and earlib. All dependencies in the deploy configuration are placed in the root of the EAR archive, and are not transitive. All dependencies in the earlib configuration are placed in the ‘lib’ directory in the EAR archive and are transitive.”

I thought under lib would only contains dependency jars, not duplications. Any insights?

I think the issue is with ‘deploy’ which place the artifact at both root and inside lib (default name) directory…
‘earlib’ works properly.


#2

My mistake, somewhere in my parent build.gradle contains the line earlib.extendsFrom deploy causing this issue. Tried to save few duplicate dependencies from dependencyManagement was the issue.