On 9/07/10 8:24 PM, Matthias Bohlen wrote:
Hi,

I want to package a JavaEE app for IBM Websphere that contains several jars, wars and external libs (also jars). More than one war references the same jars.

Now what happens is that the wars packaged by the Gradle war plugin contain the same jar files over and over again. What I really want is that the wars do not contain any jars but that all jars are packaged into the surrounding ear file, just like Rational App Developer does it.

So:
* ear should contain wars and jars
* wars should contain WEB-INF/*.xml and WEB-INF/classes, only
* jars should contain Java classes

How do I do this with Gradle?

It depends on how these things are split across projects. Here's one option, when everything is in the same project, and there's only 1 war and 1 jar.

apply plugin: 'war'
apply plugin: 'java'

war {
    // Include only classes and resources
    classpath = sourceSets.main.classes
}

task ear(type: Zip) {
    archiveName = 'myApp.ear'
    from war
    // include the jars from the runtime classpath
    from sourceSets.main.runtimeClasspath.collect { it.isFile() }
}


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to