Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
Oct 24, 2012
Aug 10, 2014
Aug 10, 2014

Gradle FatJar Plugin

WARNING: This plugin is no longer under active development. Please, migrate to Gradle Shadow Plugin which provides similar functionality.

Gradle FatJar Plugin allows you to create JAR file with all dependencies bundled inside. It handles files in META-INF/services directory gracefully by merging them. It also allows you to create slim WAR file which contains only JAR with dependencies. Classes are also bundled into the JAR instead of putting them into WEB-INF/classes.

Build Status


Plugin is hosted on Bintray. You can easily add plugin to your build script using following configuration


buildscript {
    repositories {

    dependencies {
        classpath 'eu.appsatori:gradle-fatjar-plugin:0.3'

apply plugin: 'eu.appsatori.fatjar'


Note: regular jar and war tasks are not replaced by this plugin. You can still use them. Don't forget that you need to configure fatJar and slimWar tasks if you want to modify generated manifest or exclude files not jar or war ones.


Explodes all JARs into the stage directory and merges all files needed such as those in META-INF/services.


Creates the JAR with all dependencies bundled.

This is regular Jar task so you can e.g. customize the manifest as described in Jar Task DSL. You can for example exclude files from being jared.

fatJar {
    exclude 'META-INF/*.DSA'


Bundles all output classes into JAR with dependencies and place it into WEB-INF/lib directory of the newly created WAR file.

This is regular War task so you can e.g. customize the web.xml file as described in War Task DSL. You can for example exclude files which you don't want to copy into the final WAR.

slimWar {
    exclude('WEB-INF/gtpl/', 'WEB-INF/groovy/')


File Merge

You can specify additional files to be merged using Ant-style pattern and include method on fatJarPrepareFiles task.

fatJarPrepareFiles {
  include 'META-INF/spring.handlers'
  include 'META-INF/spring.schemas'

Excluding files

You can specify files which should not be copied to fat jar using Ant-style pattern and exclude method on fatJarPrepareFiles task.

fatJarPrepareFiles {
  exclude 'META-INF/'

Exclude JARs

If you need to keep some JARs out of the JAR with dependencies you can specify extended property fatJarExclude on particular dependency. All excluded JARs will be placed in WEB-INF\lib directory if slimWar task is called.

dependencies {
  compile 'eu.appsatori:pipes:0.6.1', {
    ext {
      fatJarExclude = true

Create executable jar

Adapted from


apply plugin: 'eu.appsatori.fatjar'


task fatJar(type: Jar) {
    baseName = + '-all'
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
    with jar
    manifest {
        attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation-Version': version
        attributes 'Main-Class': 'com.organization.project.package.mainClassName'


Gradle FatJAR Plugin



No releases published


No packages published


You can’t perform that action at this time.