Jar task adds source and resources from dependency projects in ear multi project


(sascha.wander) #1

Hi,

I try to setup an ear project with mutliple subprojects. To have only compile time dependencies I use

configurations { provided { description = 'Non exported compile-time dependencies' } }
sourceSets {main { compileClasspath += configurations.provided }}
  dependencies {
 provided project(':crm-persistence')
 provided project(':crm-commons')
 provided libraries.jboss
        ...
}

But this adds the souces and resources of crm-persistence, crm-commons to the jar artifact. To define the output.classes of the jar I try something like

task createAdminJar(type: Jar){
 dependsOn classes
 from sourceSets.main.output
 include('foo/bar/admin/**')
}
artifacts{
 provided createAdminJar
}

But the source and resources of the dependency projects were still packaged to the jar. Does anybody know, what is wrong with my setup?

Thanks Sascha


(sascha.wander) #2

I found the solution

jar{
 from sourceSets.main.output
 include 'de/greenplanet/admin/**'
}

Cheers Sascha