Using Gradle (and Java, obviously), I'd like to generate a skinny war (with no dependency jars in the war), and include all of the dependencies in the ear file. I've done some digging, but I can't find any obvious "skinny war" tutorials for Gradle.
In Maven 2.2.1 (yeah, we're stuck in 2.2.1, don't ask me why), this was accomplished by creating a separate ear project and repeating all of my dependencies from my sub-projects in the ear.
I can imagine how I would duplicate this same hack in Gradle, but I'm hoping there's a smarter way to do this. Does anyone have any ideas/examples/suggestions?
the latest 1.0-M4 snapshot of gradle contains the new ear plugin. You can either update your wrapper configuration or download the snapshot directly from
The complete distribution of this snapshot downloadable at http://repo.gradle.org/gradle/distributions/gradle-snapshots/gradle-1.0-milestone-4-20110610162713+0200-all.zip contains a samples folder with two example usages of the newly introduced ear plugin.
Have a look at the example in samples/ear/earWithWar This example defines a ear with a war.
To get a skinny war, you have to modify the build.gradle of the war project. To get a war without thirdparty libs, you have to add the following snippet to samples/ear/earWithWar/war/build.gradle:
war{
classpath = []
}
To get the thirdparty libs in the lib/ subfolder of your ear you have to add the lib used by the war plugin to the earlib configuration in the root project too. The example does this for the log4j library.
Now running "gradle ear" on the example project creates a ear with a skinny war and the thirdparty libs stored in the lib/ subfolder of the ear.
The complete snapshot contains further documentation in the docs/ subfolder about the ear plugin