gradle-plugins/gradle-plugin-jlink
2024-11-03 23:37:21 +01:00
..
src more options and better tests for the jlink plugin 2024-11-03 23:37:21 +01:00
build.gradle first jmod/jlink Hello world project, successful test 2024-10-30 17:42:21 +01:00
README.md more options and better tests for the jlink plugin 2024-11-03 23:37:21 +01:00

JLink Gradle plugin

This project defines a Gradle plugin that enable the use of jlink in Gradle builds. In general, the plugin enables developers to create Java Runtimes with jlink. It uses the java toolchain to locate the jlink executable and creates a java runtime for your module path based Java application. This modularization allows small, secure and tailored application distributions.

This Gradle plugin integrates with the Gradle Java Library plugin to create distributions automatically using a jlink runtime rather than a user provided JDK runtime.

It applies the org.xbib.gradle.plugin.jlink plugin which configures a jlink task that executes the jlink tool.

plugins {
  id 'org.xbib.gradle.plugin.jlink' version "8.8.0"
}

java {
  toolchain {
    languageVersion.set(JavaLanguageVersion.of(21))
  }
}

jlink {
  modules.set(List.of("org.example.app"))
  launcher.set("app=org.example.app/org.example.app.Main")
  stripDebug.set(true)
}

In addition, the plugin configures a jmod task to download the dependent artifacts on the runtime class path and create jmod files for the jlink task. Also, a jdeps task is automatically configured to show the dependent modules.

The plugin is currently only available under Linux.