Eclipse Jar in Jar packaged as gradle plugin
Switch branches/tags
Nothing to show
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper Initial import Sep 9, 2016
src Fix for JRE 9+ from the eclipse.jdt.ui repo Oct 16, 2018
.gitignore Publishing to maven central Sep 12, 2016
Jenkinsfile Bintray publishing Sep 22, 2016 Updated the gradle publish plugin to latest Nov 10, 2018
build.gradle Updated the gradle publish plugin to latest Nov 10, 2018
gradlew Initial import Sep 9, 2016
gradlew.bat Initial import Sep 9, 2016
settings.gradle Cleaned up Sep 9, 2016


A repackaging of Eclipse's jar in jar loader easily usable as gradle plugin. It configures the default jar task so that the generated file contains all the needed dependencies without any need to distribute them separately.

It uses eclipse's jar in jar implementation for running the jar.


Apply the plugin

To use the plugin with Gradle 2.1 or later, add the following to your build.gradle file:

plugins {
  id 'net.robyf.jarinjar' version '1.0.9'

To use the plugin with Gradle 2.0 or older, or to use a snapshot release of the plugin, add the following to build.gradle:

buildscript {
    repositories {
        // The next repo is only needed while using SNAPSHOT versions
        maven { url "" }
    dependencies {
        classpath "net.robyf:gradle-jarinjar-plugin:1.0.9"
apply plugin: 'net.robyf.jarinjar'


The behavior of this plugin is controlled by setting various options in the executableJar block of your build.gradle file.

  • mainClass = <class name>: The name of the class to be executed when running the jar.
  • configuration = <configuration>: Class path used when running the jar. The default is runtime.


plugins {
    id "net.robyf.jarinjar" version "1.0.9"

apply plugin: 'java'

wrapper {
    gradleVersion = '3.0'

repositories {

dependencies {
    compile group: 'org.json', name: 'json', version: '20160810'

executableJar {
    mainClass 'com.example.MainClass'

and just run ./gradlew jar.