Gradle JarInJar Plugin

A Gradle plugin for generating self-contained executable jars.

License

License

Categories

Categories

Gradle Build Tools Net
GroupId

GroupId

net.robyf
ArtifactId

ArtifactId

gradle-jarinjar-plugin
Last Version

Last Version

1.0.9
Release Date

Release Date

Type

Type

jar
Description

Description

Gradle JarInJar Plugin
A Gradle plugin for generating self-contained executable jars.
Project URL

Project URL

https://github.com/robyf/gradle-jarinjar-plugin
Source Code Management

Source Code Management

https://github.com/robyf/gradle-jarinjar-plugin

Download gradle-jarinjar-plugin

How to add to project

<!-- https://jarcasting.com/artifacts/net.robyf/gradle-jarinjar-plugin/ -->
<dependency>
    <groupId>net.robyf</groupId>
    <artifactId>gradle-jarinjar-plugin</artifactId>
    <version>1.0.9</version>
</dependency>
// https://jarcasting.com/artifacts/net.robyf/gradle-jarinjar-plugin/
implementation 'net.robyf:gradle-jarinjar-plugin:1.0.9'
// https://jarcasting.com/artifacts/net.robyf/gradle-jarinjar-plugin/
implementation ("net.robyf:gradle-jarinjar-plugin:1.0.9")
'net.robyf:gradle-jarinjar-plugin:jar:1.0.9'
<dependency org="net.robyf" name="gradle-jarinjar-plugin" rev="1.0.9">
  <artifact name="gradle-jarinjar-plugin" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.robyf', module='gradle-jarinjar-plugin', version='1.0.9')
)
libraryDependencies += "net.robyf" % "gradle-jarinjar-plugin" % "1.0.9"
[net.robyf/gradle-jarinjar-plugin "1.0.9"]

Dependencies

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

gradle-jarinjar-plugin

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.

Usage

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 {
        mavenCentral()
        // The next repo is only needed while using SNAPSHOT versions
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }
    dependencies {
        classpath "net.robyf:gradle-jarinjar-plugin:1.0.9"
    }
}
apply plugin: 'net.robyf.jarinjar'

Configuration

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.

Example

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

apply plugin: 'java'

wrapper {
    gradleVersion = '3.0'
}

repositories {
    jcenter()
}

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

executableJar {
    mainClass 'com.example.MainClass'
}

and just run ./gradlew jar.

Versions

Version
1.0.9
1.0.8
1.0.6
1.0.0.5
1.0.0.1