Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A gradle build task for simplifying creation of custom Java9 jre environments.

Build Status


Java9 brings with it the ability to create custom java runtime execution (JRE) environments tailored to run a specific app or set of apps. I.e. using the Java Platform Module System (JPMS) aka project Jigsaw.

In order to create a custom jre two command line utilities are required: jdeps and jlink.

dplink removes the need to invoke jdeps, collate the required java modules and then call jlink specifying those modules (i.e. dplink does the invocation of jdeps and jlink for you).

In addition, on unix type platforms, you can tell dplink to embed an executable script inside the created jre that will run an executable jar.

How to use

JRE only

In it's simplest form add the following to your build.gradle file:

plugins {
    id "com.alkimiapps.gradle-dplink-plugin" version "0.3"

Then invoke:

gradle dplink

That will build your project and make a jre in your local build/app folder that contains only the java modules on which your build is dependent.

JRE + App executable script

If you're using something that can run a bash shell script and you have an executable jar and you would like the built jre to contain it along with an executable script to execute that executable jar, then you need to provide a bit more information to dplink in your build.gradle file.

At minimum you need to specify the main class name e.g (in your build.gradle file)

dplink {

I.e the java package and class name of the main class of the executable jar.

If your build/libs folder contains a single jar then dplink assumes that it the executable jar and it will use that. On the other hand if your build/libs contains multiple jars you'll need to tell dplink which one is the executable e.g:

dplink {

The executable script is by default: build/app/bin/app

Dplink Task Options

All dplink tasks are optional but, depending on what you want to do, some may be required.

  • mainClassName : specifies the fully qualified class name of the main class of an executable jar
  • executableJar : the name of the executable jar to use for creating the executable script
  • jvmArgs : jvm arguments to use for executing the app (e.g. -Xmx etc)
  • appName : name for the executable script when there is a mainClassName and executable jar - defaults to app
  • appArgs : args that should be passed into the application (note these or more can also be specifed at app execution time i.e on the command line)
  • javaHome : absolute path of your java installation (i.e. containing the bin directory with jdeps and jlink) - defaults to System.getProperty("java.home")
  • modulesHome : absolute path of the java installation that should be the base for the resulting image, used to allow images for alternate operating systems - defaults to System.getProperty("java.home")
  • outputDir : path (relative or absolute) specifying where the custom jre should be placed - defaults to build/app
  • fatJar : true if the exectuableJar is a shaded or fat jar so all other jar files in the lib folder will be ignored - defaults to false
  • allJavaModules : set to true only if jdeps should be skipped to speed up plugin execution time, note all available java modules will be copied to the image - defaults to false


  • More tests and more configurability
  • Better fat jar and thin jar support
  • Other stuff I haven't thought of yet



gradle-dplink-plugin is licensed under MIT license.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.