NOTE: This is a fork of the original Badass-Jlink-Plugin that is patched to support newer Java releases and other fixes not yet available with the original plugin.
3.1.0
Base line for this version is the upstream 3.1.0 plugin.
In addition, these changes are included:
- support parsing annotated module declarations, this makes it possible to use JSpecify
@NullMarked
on the module declaration.
3.0.1-patch-1
- fix secondary Launcher fails in Kotlin DSL (issue in original repository: #244)
- update ASM for compatibility with newer JDK versions
- fix building the plugin on Windows ARM:
- disable Gradle toolchains (not yet working on Windows ARM)
- disable JavaFX tests on Windows ARM because the JavaFX plugin is not yet compatible with the platform. You can still build JavaFX jlink applications on Windows ARM if you do not use the JavaFX plugin (use a local installation of JavaFX or a JDK that is prebuilt with JavaFX support or manually add the correct JavaFX dependencies).
Make sure your environment is set to use JDK 17 (I have disabled toolchains because of missing support on Windows ARM)
Change the plugin ID from org.beryx.jlink
to com.dua3.gradle.jlink
in your Gradle build files.
NOTE: Looking for co-maintainers - see this issue.
Using this Gradle plugin you can create a custom runtime image of your modular application with minimal effort, even if it depends on automatic modules. The plugin also lets you create an application installer with the jpackage tool introduced in Java 14 (see fxgl-sliding-puzzle for a usage example).
💡 For non-modular applications use the Badass-Runtime plugin.
Badass-JLink exposes an extension with the name jlink
to let you configure various
aspects of its operation.
A simple example configuration is shown below:
jlink {
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
launcher{
name = 'hello'
jvmArgs = ['-Dlog4j.configurationFile=./log4j2.xml']
}
}
This is a complex plugin. Please read the documentation before using it.
The following projects illustrate how to use this plugin to create custom runtime images:
- badass-jlink-example - a 'Hello world' application using slf4j and logback.
- badass-jlink-example-log4j2-javafx - a 'Hello world' JavaFX application using log4j2.
- badass-jlink-example-javafx-multiproject - A 'Hello world' JavaFX application with a Gradle multi-project build.
- badass-jlink-example-richtextfx - A RichTextFX project that shows how to configure splash screens and file associations when using jpackage.
- badass-jlink-example-kotlin-javafx - a 'Hello world' JavaFX application written in Kotlin.
- badass-jlink-example-kotlin-tornadofx - a 'Hello world' application written in Kotlin using tornadofx.
- badass-jlink-spring-petclinic - creates a custom runtime image of the Spring PetClinic application.
- fxgl-sliding-puzzle - a sliding puzzle game using the FXGL library.
- copper-modular-demo - creates a custom runtime image of a COPPER 5 modular application.
- javafx-jlink-starter-gradle - A JavaFX starter project with an Azure Pipelines setup that produces binaries for Windows, Mac, and Linux.
- javafx-springboot-badass-jlink - A modular JavaFX application with Spring Boot.
- pdf-decorator - A JavaFX tool to add stamps and backgrounds to PDF documents. There's also a related article explaining how to migrate to this plugin.
See the list of all releases if you use an older version of this plugin.