From 1e42748fd132e13967d873acb68f9ba4f4adc0c3 Mon Sep 17 00:00:00 2001 From: Casey Brooks Date: Tue, 16 Mar 2021 11:36:47 -0500 Subject: [PATCH] Updates Native Distributions documentation Updates Native Distributions documentation to include a note about Java Modules, and how to determine necessary modules and provide them to the Gradle plugin configuration --- .../README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tutorials/Native_distributions_and_local_execution/README.md b/tutorials/Native_distributions_and_local_execution/README.md index 28ba4db5f5..a6b6cf1952 100755 --- a/tutorials/Native_distributions_and_local_execution/README.md +++ b/tutorials/Native_distributions_and_local_execution/README.md @@ -8,7 +8,14 @@ We will also demonstrate how to run an application locally with the same setting ## Gradle plugin `org.jetbrains.compose` Gradle plugin simplifies the packaging of applications into native distributions and running an application locally. -Currently, the plugin uses [jpackage](https://openjdk.java.net/jeps/343) for packaging self-contained applications. + +Currently, the plugin uses [jpackage](https://openjdk.java.net/jeps/343) for packaging distributable applications. +Distributable applications are self-contained, installable binaries which include all the Java runtime components they need, +without requiring an installed JDK on the target system. + +[Jlink](https://openjdk.java.net/jeps/282) will take care of bundling only the necessary Java Modules in +the distributable package to minimize package size, +but you must still configure the Gradle plugin to tell it which modules you need. ## Basic usage @@ -36,6 +43,7 @@ compose.desktop { mainClass = "example.MainKt" nativeDistributions { + modules("java.sql") targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) } } @@ -57,13 +65,18 @@ containing the `main` function. Note, that `run` starts a non-packaged JVM application with full runtime. This is faster and easier to debug, than creating a compact binary image with minified runtime. To run a final binary image, use `runDistributable` instead. -* `createDistributable` is used to create a prepackaged application image a final application image without creating an installer. +* `createDistributable` is used to create a prepackaged application image a final application image without creating an installer. * `runDistributable` is used to run a prepackaged application image. Note, that the tasks are created only if the `application` block/property is used in a script. After a build, output binaries can be found in `${project.buildDir}/compose/binaries`. +At this time, the Gradle plugin does not automatically determine the JDK Modules necessary to run, and you must manually +determine the specific modules you need and include them in `modules()`. Failure to provide the necessary modules +will not cause compilation issues, but will lead to `ClassNotFoundException` at runtime. See issue #463 for more context +and how to determine the modules you need to include. + ## Available formats The following formats available for the supported operating systems: