The English version of quarkus.io is the official project site. Translated sites are community supported on a best-effort basis.
このページを編集

JLink packaging

experimental

The jlink extension produces a custom Java runtime image for a Quarkus application. The image contains only the JDK modules and application modules that are needed to run the application, resulting in a smaller, faster, and more self-contained distribution. This extension depends on the Quarkus modularity extension to compute the application’s module graph.

この技術は、experimentalと考えられています。

experimental モードでは、アイデアを成熟させるために早期のフィードバックが求められます。ソリューションが成熟するまでの間、プラットフォームの安定性や長期的な存在を保証するものではありません。フィードバックは メーリングリストGitHubの課題管理 で受け付けています。

とりうるステータスの完全なリストについては、 FAQの項目 を参照してください。

前提条件

The jlink extension requires Java 25 or later. Earlier JDK versions have compatibility issues with the jlink tool that prevent reliable image generation.

使用方法

Add the quarkus-jlink extension to your project. When the extension is present, a jlink image is produced automatically as part of the normal Quarkus build. JAR packaging is disabled when jlink is active.

コマンドラインインタフェース
quarkus extension add quarkus-jlink
Maven
./mvnw quarkus:add-extension -Dextensions='quarkus-jlink'
Gradle
./gradlew addExtension --extensions='quarkus-jlink'

After adding the extension, build the project normally:

コマンドラインインタフェース
quarkus build
Maven
./mvnw install
Gradle
./gradlew build

The jlink image is written to the output directory (by default, target/jlink-output/image).

Running the image

To run the application, execute the launcher script in the image’s bin directory:

./target/jlink-output/image/bin/<launcher-name>

The launcher name currently defaults to my-app. A future release will derive the default from quarkus.package.output-name.

Image layout

The output directory has the standard jlink image structure. The bin/ directory contains the launcher script. The lib/ directory contains the JDK runtime modules. Application modules that are not on the boot module path are placed in lib/quarkus/ and are loaded dynamically on demand after startup by smallrye-modules. See the modularity guide for an explanation of boot modules and dynamic modules.

設定リファレンス

ビルド時に固定された設定プロパティー。その他の設定プロパティーは、すべて実行時にオーバーライド可能です。

Configuration property

タイプ

デフォルト

Whether jlink image generation is enabled.

Environment variable: QUARKUS_JLINK_ENABLED

Show more

ブーリアン

true

The minimum heap size to configure for the image. If not given, no minimum heap size is specified.

Environment variable: QUARKUS_JLINK_MIN_HEAP_SIZE

Show more

MemorySize 

The maximum heap size to configure for the image. If not given, no maximum heap size is specified.

Environment variable: QUARKUS_JLINK_MAX_HEAP_SIZE

Show more

MemorySize 

The image output path. If relative, it will be resolved in terms of the packaging output path.

Environment variable: QUARKUS_JLINK_IMAGE_PATH

Show more

path

image

The name of the launcher script generated in the image’s bin/ directory.

Environment variable: QUARKUS_JLINK_LAUNCHER_NAME

Show more

string

my-app

The base output directory for the jlink build.

Environment variable: QUARKUS_JLINK_OUTPUT_DIRECTORY

Show more

path

target/jlink-output

The path of the staging directory used during the jlink build process, relative to the output directory.

Environment variable: QUARKUS_JLINK_STAGING_DIRECTORY

Show more

path

staging

CDS support

Support for Class Data Sharing (CDS) and AOT precompilation within jlink images is planned for a future release.

CDS currently only applies to modules on the boot module path. Dynamic modules loaded by smallrye-modules are not eligible for CDS precompilation at this time.

関連コンテンツ