One-Jar: package a Groovy application together with its dependency Jars into a single executable Jar file

Hi, I’m new to Gradle and looking for a plugin or recipe to create a build.gradle that will create a single executable jar file from my groovy project (which has a mix of groovy and java). lists a plugin OneJar ( but it no longer appears to be available (or at least is failing to download from repo).

There is a sourceforge project One-Jar ( that can be run from Ant script so presumably this can in turn be called from Gradle. However, before I plunge off in this direction I wanted to check if more experienced folks had better ideas.

(While I appreciate create big fat jars isn’t necessarily best practice it is extremely convenient for a lot of the work we do with small data handling utilities we use around the desk).

Can anyone point me in the right (or better) direction?

Many thanks, peter

Try this in your build.gradle:

jar {
         from {
            configurations.compile.collect {
                it.isDirectory() ? it : zipTree(it)

You’ll want ‘configurations.runtime’. Also you’ll probably want to set the ‘Main-Class’ attribute in the Jar manifest.

For small and self-contained apps, Gradle’s application plugin is a good fit.