Jlink
Creates a Java Runtime image using jlink.
Cross platform Java runtime images may be created however you must ensure that all configured JDKs have the same matching major version. |
You have to install additional JDKs to enable cross-platform images. JReleaser will not install these JDKs for you. You may configure the JDKs Maven Plugin or the JDKs Gradle Plugin to downloads JDKs. |
Configuration
Legend:
-
required
-
optional
-
may use environment variable
-
accepts Name Templates
#
assemble:
#
jlink:
# Assemblers require a name.
#
app:
# Enables or disables the assembler.
# Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `NEVER`.
#
active: ALWAYS
# Export the assembled artifacts as a matching named distribution.
# Defaults to `true`.
#
exported: true
# The stereotype of this assembler.
# Supported values are [`NONE`, `CLI`, `DESKTOP`, `WEB`, `MOBILE`].
# Defaults to `#{project.stereotype}`.
#
stereotype: CLI
# Additional properties used when evaluating templates.
#
extraProperties:
# Key will be capitalized and prefixed with `jlink`, i.e, `jlinkFoo`.
foo: bar
#
platform:
# Key value pairs.
# Keys match a full platform or an os.name, os.arch.
# Same rules apply as in Platform.
#
replacements:
osx-x86_64: mac
aarch_64: aarch64
x86_64: amd64
linux_musl: alpine
# Name of the executable launcher.
# If left undefined, will use `#{assembler.name}`.
#
executable: app
# Name of the generated image.
# If left undefined, will use
# `#{project.java.groupId}.#{project.java.artifactId}-#{project.version}`.
# Generated artifacts always have the platform as suffix.
#
imageName: 'app-{{projectVersion}}'
# Name transformation of the generated image.
# Transformed artifacts always have the platform as suffix.
#
imageNameTransform: 'app-{{projectEffectiveVersion}}'
# Archive format to use.
# Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TBZ2`, `TGZ`, `TXZ`].
# Defaults to `ZIP`.
#
archiveFormat: ZIP
# List of module names.
# Overrides modules found by jdeps.
# Setting any values here automatically disables jdeps.
#
moduleNames:
- java.base
- com.acme.demo
# List of additional module names.
# Additional required modules but not detected by jdeps.
#
additionalModuleNames:
- jdk.crypto.ec
- jdk.localedata
# List of JDKs for generating cross-platform images.
#
targetJdks:
- path: path/to/jdk
platform: osx-x86_64
- path: path/to/jdk
platform: linux-x86_64
# The JDK to use.
# If undefined, will find a matching JDK.
#
jdk:
path: path/to/jdk
platform: linux-x86_64
# Configuration flags for Jdeps
#
jdeps:
# Enables or disables jdeps
# If disabled then [`java.base`] is set as default value for `moduleNames`,
# you may define an explicit value for `moduleNames` or use `additionalModuleNames`.
# Defaults to `true`
#
enabled: true
# Specifies the version when processing multi-release jar files.
# Value should be integer >= 9 or `base`.
# Defaults to empty
#
multiRelease: base
# Ignore missing dependences.
# Defaults to `false`
#
ignoreMissingDeps: true
# Use wildcard expression in classpath.
# Defaults to `true`
#
useWildcardInPath: false
# JARs or classes used to limit the module search
# Must be defined as paths.
# Defaults to empty.
#
targets:
- out/classes/com/acme/Main.class
# A list of build arguments.
# Defaults are shown.
#
args:
- "--no-header-files"
- "--no-man-pages"
- "--compress zip-9"
- "--strip-debug"
# Copy main and input JARs into archive.
# Defaults to `true`.
#
copyJars: true
#
options:
# Timestamp to use for each entry.
# Must follow ISO-8601 +HH:MM timezone offset.
# Example: 2023-03-08T12:56:33.024578+01:00
# Defaults to timestamp for latest git commit or current time.
#
timestamp: '2020-01-01T00:00:00.000000+00:00'
# Set longFileMode for tar archives.
# Possible values are [`ERROR`, `GNU`, `POSIX`, `TRUNCATE`].
# Defaults to `ERROR`.
#
longFileMode: POSIX
# Set bigNumberMode for tar archives.
# Possible values are [`ERROR`, `GNU`, `POSIX`].
# Defaults to `ERROR`.
#
bigNumberMode: POSIX
# The executable JAR that contains the application.
#
mainJar:
path: path/to/app.jar
# Defines a list of additional JARs as globs.
#
jars:
# The pattern to use.
# May use glob or regex pattern syntax.
#
- pattern: path/to/**/*.jar
#
java:
# Name of main module (if any).
# Define only if the application is modular.
#
mainModule: com.acme.demo
# The application's entry point.
# If left undefined, will use `#{project.java.mainClass}`.
#
mainClass: com.acme.Main
# Options to pass to the Java runtime
#
jvmOptions:
# Included in all scripts
#
universal:
- -Dprop=value
# Included in all non Windows scripts
#
unix:
- -Dprop=value
# Included in all non Windows (except OSX) scripts
#
linux:
- -Dprop=value
# Included only in OSX scripts
#
osx:
- -Dprop=value
# Included in Windows scripts
#
windows:
- -Dprop=value
# Environment variables used in launch scripts.
#
environmentVariables:
# Included in all scripts
#
universal:
KEY: value
# Included in all non Windows scripts
#
unix:
KEY: value
# Included in all non Windows (except OSX) scripts
#
linux:
KEY: value
# Included only in OSX scripts
#
osx:
KEY: value
# Included in Windows scripts
#
windows:
KEY: value
# Maven coordinates: groupId.
# If left undefined, will use `#{project.java.groupId}`.
#
groupId: com.acme
# Maven coordinates: artifactId.
# If left undefined, will use `#{project.java.artifactId}`.
#
artifactId: app
# The minimum Java version required by consumers to run the application.
# If left undefined, will use `#{project.java.version}`.
#
version: 8
# Identifies the project as being member of a multi-project build.
# If left undefined, will use `#{project.java.multiProject}`.
#
multiProject: false
# Additional properties used when evaluating templates.
#
extraProperties:
# Key will be capitalized and prefixed with `java`, i.e, `javaFoo`.
foo: bar
# Inputs as a Java Archive
#
javaArchive:
# Path to the source Java archive.
#
path: path/to/app-1.0.0.zip
# Name of the main JAR.
# Defaults to `{{projectName}}-{{projectVersion}}.jar`.
#
mainJarName: '{{projectName}}-{{projectVersion}}.jar'
# Path within archive containing JAR files.
# Defaults to `lib`.
#
libDirectoryName: lib
# Directory with file templates used to prepare the assembler.
# Defaults to `src/jreleaser/assemblers/#{distribution.name}/jlink`.
# If specified, path must exist.
#
templateDirectory: path/to/jlink/templates
# List of template files to be skipped.
# Value may be an exact match or a regex.
#
skipTemplates:
- README.md.tpl
# Defines a list of additional files as artifacts.
# These files will be added to the assembled archive.
#
artifacts:
- path: path/to/file
- path: path/to/another_file
transform: path/inside/archive
- path: path/to/platform/specific/file
platform: osx-x86_64
# Defines a list of additional files as globs.
# These files will be added to the assembled archive.
#
files:
# The pattern to use.
# May use glob or regex pattern syntax.
#
- pattern: path/to/**/*.txt
# Defines a list of additional files as filesets.
# These files will be added to the assembled archive.
#
fileSets:
# The input directory to copy files from.
#
- input: path/to/input/directory
# The target path inside the archive.
# If left undefined, defaults to the root of the archive.
#
output: path/to/archive/entry
# Fail if the given `input` does not exist.
# Defaults to `true`.
#
failOnMissingInput: false
# A set of files and directory to include.
#
includes:
- 'name_or_regex'
# A set of files and directory to exclude.
#
excludes:
- 'name_or_regex'
# Additional properties used when evaluating templates.
#
extraProperties:
# Key will be capitalized and prefixed with `artifact`, i.e, `artifactFoo`.
foo: bar
#
swid:
# Tags require a name.
#
mytag:
# Enables or disables the tag.
# Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `NEVER`.
#
active: ALWAYS
# Reference to a common tag.
#
tagRef: swid-tag
# Path where the tag file will be placed.
# Defaults to `SWIDTAG`.
#
path: SWID
# A globally unique identifier and should be assigned a GUID reference.
# Defaults to a UUID generated with `groupId`, `artifactId`, `version`, `vendor`.
#
tagId: c526ec37-2715-328e-8bbc-4eb5a9f47c98
# Indicates if a specific release of a software product has more than one tag that can represent that specific release.
# Defaults to `1`.
#
tagVersion: 2
# Language used in the tag document.
# Defaults to `en-US`.
#
lang: de
# If this SWID tag is a collection of information that describes the pre-installation data of software component.
# Defaults to `false`.
#
corpus: true
# If this SWID tag describes a product patch or modification to a different software element.
# Defaults to `false`.
#
patch: false
# List of organizations related to the software component referenced by this SWID tag.
#
entities:
# name of the organization claiming a particular role in the SWID tag.
#
- name: Acme
# URI of the claiming organization.
# Defaults to `http://invalid.unavailable`.
#
regid: https://acme.com
# The relationship between this organization and this tag e.g. tag, `softwareCreator`, `licensor`, `tagCreator`, etc.
# The role of `tagCreator` is required for every SWID tag. May include any role value, but the pre-defined roles
# include: `aggregator`, `distributor`, `licensor`, `softwareCreator`, `tagCreator`.
# Other roles will be defined as the market uses the SWID tags.
# Defaults to [`tagCreator`, `softwareCreator`].
#
roles:
- tagCreator
- softwareCreator
# Assemblers require a name.
#
[assemble.jlink.app]
# Enables or disables the assembler.
# Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `NEVER`.
#
active = "ALWAYS"
# Export the assembled artifacts as a matching named distribution.
# Defaults to `true`.
#
exported = true
# The stereotype of this assembler.
# Supported values are [`NONE`, `CLI`, `DESKTOP`, `WEB`, `MOBILE`].
# Defaults to `#{project.stereotype}`.
#
stereotype = "CLI"
# Additional properties used when evaluating templates.
#
extraProperties.foo = "bar"
# Key will be capitalized and prefixed with `jlink`, i.e, `jlinkFoo`.
# Key value pairs.
# Keys match a full platform or an os.name, os.arch.
# Same rules apply as in Platform.
#
[assemble.jlink.app.platform.replacements]
osx-x86_64 = "mac"
aarch_64 = "aarch64"
x86_64 = "amd64"
linux_musl = "alpine"
# Name of the executable launcher.
# If left undefined, will use `#{assembler.name}`.
#
executable = "app"
# Name of the generated image.
# If left undefined, will use
# `#{project.java.groupId}.#{project.java.artifactId}-#{project.version}`.
# Generated artifacts always have the platform as suffix.
#
imageName = "app-{{projectVersion}}"
# Name transformation of the generated image.
# Transformed artifacts always have the platform as suffix.
#
imageNameTransform = "app-{{projectEffectiveVersion}}"
# Archive format to use.
# Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TBZ2`, `TGZ`, `TXZ`].
# Defaults to `ZIP`.
#
archiveFormat = "ZIP"
# List of module names.
# Overrides modules found by jdeps.
# Setting any values here automatically disables jdeps.
#
moduleNames = [
"java.base",
"com.acme.demo"]
# List of additional module names.
# Additional required modules but not detected by jdeps.
#
additionalModuleNames = [
"jdk.crypto.ec",
"jdk.localedata"]
# List of JDKs for generating cross-platform images.
#
targetJdks = [
{ path = "path/to/jdk", platform = "osx-x86_64" },
{ path = "path/to/jdk", platform = "linux-x86_64" }]
# The JDK to use.
# If undefined, will find a matching JDK.
#
jdk = { path = "path/to/jdk", platform = "linux-x86_64" }
# Configuration flags for Jdeps
#
# Enables or disables jdeps
# If disabled then [`java.base`] is set as default value for `moduleNames`,
# you may define an explicit value for `moduleNames` or use `additionalModuleNames`.
# Defaults to `true`
#
jdeps.enabled = true
# Specifies the version when processing multi-release jar files.
# Value should be integer >= 9 or `base`.
# Defaults to empty
#
jdeps.multiRelease = 'base'
# Ignore missing dependences.
# Defaults to `false`
#
jdeps.ignoreMissingDeps = true
# Use wildcard expression in classpath.
# Defaults to `true`
#
jdeps.useWildcardInPath = false
# JARs or classes used to limit the module search
# Must be defined as paths.
# Defaults to empty.
#
jdeps.targets = [ "out/classes/com/acme/Main.class" ]
# A list of build arguments.
# Defaults are shown
#
args = ["--no-header-files",
"--no-man-pages",
"--compress zip-9",
"--strip-debug"]
# Copy main and input JARs into archive.
# Defaults to `true`.
#
copyJars = true
# Timestamp to use for each entry.
# Must follow ISO-8601 +HH:MM timezone offset.
# Example: 2023-03-08T12:56:33.024578+01:00
# Defaults to timestamp for latest git commit or current time.
#
options.timestamp = "2020-01-01T00:00:00.000000+00:00"
# Set longFileMode for tar archives.
# Possible values are [`ERROR`, `GNU`, `POSIX`, `TRUNCATE`].
# Defaults to `ERROR`.
#
options.longFileMode = "POSIX"
# Set bigNumberMode for tar archives.
# Possible values are [`ERROR`, `GNU`, `POSIX`].
# Defaults to `ERROR`.
#
options.bigNumberMode = "POSIX"
# The executable JAR that contains the application.
#
mainJar = { path = "path/to/app.jar" }
# Defines a list of additional JARs as globs.
#
[[assemble.jlink.app.jars]]
# The pattern to use.
# May use glob or regex pattern syntax.
#
pattern = "path/to/**/*.jar"
# Name of main module (if any).
# Define only if the application is modular.
#
java.mainModule = "com.acme.demo"
# The application's entry point.
# If left undefined, will use `#{project.java.mainClass}`.
#
java.mainClass = "com.acme.Main"
# Options to pass to the Java runtime
# Included in all scripts
#
java.jvmOptions.universal = ["-Dprop=value"]
# Included in all non Windows scripts
#
java.jvmOptions.unix = ["-Dprop=value"]
# Included in all non Windows (except OSX) scripts
#
java.jvmOptions.linux = ["-Dprop=value"]
# Included only in OSX scripts
#
java.jvmOptions.osx = ["-Dprop=value"]
# Included in Windows scripts
#
java.jvmOptions.windows = ["-Dprop=value"]
# Environment variables used in launch scripts.
# Included in all scripts
#
java.environmentVariables.universal.KEY = "value"
# Included in all non Windows scripts
#
java.environmentVariables.unix.KEY = "value"
# Included in all non Windows (except OSX) scripts
#
java.environmentVariables.linux.KEY = "value"
# Included only in OSX scripts
#
java.environmentVariables.osx.KEY = "value"
# Included in Windows scripts
#
java.environmentVariables.windows.KEY = "value"
# Maven coordinates: groupId.
# If left undefined, will use `#{project.java.groupId}`.
#
java.groupId = "com.acme"
# Maven coordinates: artifactId.
# If left undefined, will use `#{project.java.artifactId}`.
#
java.artifactId = "app"
# The minimum Java version required by consumers to run the application.
# If left undefined, will use `#{project.java.version}`.
#
java.version = "8"
# Identifies the project as being member of a multi-project build.
# If left undefined, will use `#{project.java.multiProject}`.
#
java.multiProject = false
# Additional properties used when evaluating templates.
#
java.extraProperties.foo = "bar"
# Key will be capitalized and prefixed with `java`, i.e, `javaFoo`.
# Inputs as a Java Archive
#
# Path to the source Java archive.
#
javaArchive.path = "path/to/app-1.0.0.zip"
# Name of the main JAR.
# Defaults to `{{projectName}}-{{projectVersion}}.jar`.
#
javaArchive.mainJarName = "{{projectName}}-{{projectVersion}}.jar"
# Path within archive containing JAR files.
# Defaults to `lib`.
#
javaArchive.libDirectoryName = "lib"
# Directory with file templates used to prepare the assembler.
# Defaults to `src/jreleaser/assemblers/#{distribution.name}/jlink`.
# If specified, path must exist.
#
templateDirectory = "path/to/jlink/templates"
# List of template files to be skipped.
# Value may be an exact match or a regex.
#
skipTemplates = [ "README.md.tpl" ]
# Defines a list of additional files as artifacts.
# These files will be added to the assembled archive.
#
[[assemble.jlink.app.artifacts]]
path = "path/to/file"
[[assemble.jlink.app.artifacts]]
path = "path/to/another_file"
transform = "path/inside/archive"
[[assemble.jlink.app.artifacts]]
path = "path/to/platform/specific/file"
platform = "osx-x86_64"
# Defines a list of additional files as globs.
# These files will be added to the assembled archive.
#
[[assemble.jlink.app.files]]
# The pattern to use.
# May use glob or regex pattern syntax.
#
pattern = "path/to/**/*.txt"
# Defines a list of additional files as filesets.
# These files will be added to the assembled archive.
#
[[assemble.jlink.app.fileSets]]
# The input directory to copy files from.
#
input = "path/to/input/directory"
# The target path inside the archive.
# If left undefined, defaults to the root of the archive.
#
output = "path/to/archive/entry"
# Fail if the given `input` does not exist.
# Defaults to `true`.
#
failOnMissingInput = false
# A set of files and directory to include.
#
includes = ["name_or_regex"]
# A set of files and directory to exclude.
#
excludes = ["name_or_regex"]
# Additional properties used when evaluating templates.
#
[[assemble.jlink.app.fileSets.extraProperties]]
# Key will be capitalized and prefixed with `artifact`, i.e, `artifactFoo`.
foo: bar
#
[assemble.jlink.app.swid]
# Enables or disables the tag.
# Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `NEVER`.
#
active = "ALWAYS"
# Reference to a common tag.
#
tagRef = "swid-tag"
# Path where the tag file will be placed.
# Defaults to `SWIDTAG`.
#
path = "SWID"
# A globally unique identifier and should be assigned a GUID reference.
# Defaults to a UUID generated with `groupId`, `artifactId`, `version`, `vendor`.
#
tagId = "c526ec37-2715-328e-8bbc-4eb5a9f47c98"
# Indicates if a specific release of a software product has more than one tag that can represent that specific release.
# Defaults to `1`.
#
tagVersion = 2
# Language used in the tag document.
# Defaults to `en-US`.
#
lang = "de"
# If this SWID tag is a collection of information that describes the pre-installation data of software component.
# Defaults to `false`.
#
corpus = true
# If this SWID tag describes a product patch or modification to a different software element.
# Defaults to `false`.
#
patch = false
# List of organizations related to the software component referenced by this SWID tag.
#
[[assemble.jlink.app.swid.entities]]
# name of the organization claiming a particular role in the SWID tag.
#
name = "Acme"
# URI of the claiming organization.
# Defaults to `http://invalid.unavailable`.
#
regid = "https://acme.com"
# The relationship between this organization and this tag e.g. tag, `softwareCreator`, `licensor`, `tagCreator`, etc.
# The role of `tagCreator` is required for every SWID tag. May include any role value, but the pre-defined roles
# include: `aggregator`, `distributor`, `licensor`, `softwareCreator`, `tagCreator`.
# Other roles will be defined as the market uses the SWID tags.
# Defaults to [`tagCreator`, `softwareCreator`].
#
roles = ["tagCreator", "softwareCreator"]
{
//
"assemble": {
//
"jlink": {
// Assemblers require a name.
//
"app": {
// Enables or disables the assembler.
// Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
// Defaults to `NEVER`.
//
"active": "ALWAYS",
// Export the assembled artifacts as a matching named distribution.
// Defaults to `true`.
//
"exported": true,
// The stereotype of this assembler.
// Supported values are [`NONE`, `CLI`, `DESKTOP`, `WEB`, `MOBILE`].
// Defaults to `#{project.stereotype}`.
//
"stereotype": "CLI",
// Additional properties used when evaluating templates.
//
"extraProperties": {
// Key will be capitalized and prefixed with `jlink`, i.e, `jlinkFoo`.
"foo": "bar"
},
//
platform: {
// Key value pairs.
// Keys match a full platform or an os.name, os.arch.
// Same rules apply as in Platform.
//
"replacements": {
"osx-x86_64": "mac",
"aarch_64": "aarch64",
"x86_64": "amd64",
"linux_musl": "alpine"
}
},
// Name of the executable launcher.
// If left undefined, will use `#{assembler.name}`.
//
"executable": "app",
// Name of the generated image.
// If left undefined, will use
// `#{project.java.groupId}.#{project.java.artifactId}-#{project.version}`.
// Generated artifacts always have the platform as suffix.
//
"imageName": "app-{{projectVersion}}",
// Name transformation of the generated image.
// Transformed artifacts always have the platform as suffix.
//
"imageNameTransform": "app-{{projectEffectiveVersion}}",
// Archive format to use.
// Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TBZ2`, `TGZ`, `TXZ`].
// Defaults to `ZIP`.
//
"archiveFormat": "ZIP",
// List of module names.
// Overrides modules found by jdeps.
// Setting any values here automatically disables jdeps.
//
"moduleNames": [
"java.base",
"com.acme.demo"
],
// List of additional module names.
// Additional required modules but not detected by jdeps.
//
"additionalModuleNames": [
"jdk.crypto.ec",
"jdk.localedata"
],
// List of JDKs for generating cross-platform images.
//
"targetJdks": [
{
"path": "path/to/jdk",
"platform": "osx-x86_64"
},
{
"path": "path/to/jdk",
"platform": "linux-x86_64"
}
],
// The JDK to use.
// If undefined, will find a matching JDK.
//
"jdk": {
"path": "path/to/jdk",
"platform": "linux-x86_64"
},
// Configuration flags for Jdeps
//
"jdeps": {
// Enables or disables jdeps
// If disabled then [`java.base`] is set as default value for `moduleNames`,
// you may define an explicit value for `moduleNames` or use `additionalModuleNames`.
// Defaults to `true`
//
"enabled": true,
// Specifies the version when processing multi-release jar files.
// Value should be integer >= 9 or `base`.
// Defaults to empty
//
"multiRelease": "base",
// Ignore missing dependences.
// Defaults to `false`
//
"ignoreMissingDeps": true,
// Use wildcard expression in classpath.
// Defaults to `true`
//
"useWildcardInPath": false,
// JARs or classes used to limit the module search
// Must be defined as paths.
// Defaults to empty.
//
"targets": [
"out/classes/com/acme/Main.class"
]
},
// A list of build arguments.
// Defaults are shown.
//
"args": [
"--no-header-files",
"--no-man-pages",
"--compress zip-9",
"--strip-debug"
],
// Copy main and input JARs into archive.
// Defaults to `true`.
//
"copyJars": true,
//
"options": {
// Timestamp to use for each entry.
// Must follow ISO-8601 +HH:MM timezone offset.
// Example: 2023-03-08T12:56:33.024578+01:00
// Defaults to timestamp for latest git commit or current time.
//
"timestamp": "2020-01-01T00:00:00.000000+00:00",
// Set longFileMode for tar archives.
// Possible values are [`ERROR`, `GNU`, `POSIX`, `TRUNCATE`].
// Defaults to `ERROR`.
//
"longFileMode": "POSIX",
// Set bigNumberMode for tar archives.
// Possible values are [`ERROR`, `GNU`, `POSIX`].
// Defaults to `ERROR`.
//
"bigNumberMode": "POSIX"
},
// The executable JAR that contains the application.
//
"mainJar": {
"path": "path/to/app.jar"
},
// Defines a list of additional JARs as globs.
//
"jars": [
{
// The pattern to use.
// May use glob or regex pattern syntax.
//
"pattern": "path/to/**/*.jar"
}
],
//
"java": {
// Name of main module (if any).
// Define only if the application is modular.
//
"mainModule": "com.acme.demo",
// The application's entry point.
// If left undefined, will use `#{project.java.mainClass}`.
//
"mainClass": "com.acme.Main",
// Options to pass to the Java runtime
//
"jvmOptions": {
// Included in all scripts
//
"universal": [
"-Dprop=value"
],
// Included in all non Windows scripts
//
"unix": [
"-Dprop=value"
],
// Included in all non Windows (except OSX) scripts
//
"linux": [
"-Dprop=value"
],
// Included only in OSX scripts
//
"osx": [
"-Dprop=value"
],
// Included in Windows scripts
//
"windows": [
"-Dprop=value"
]
},
// Environment variables used in launch scripts.
//
"environmentVariables": {
// Included in all scripts
//
"universal": {
"KEY": "value"
},
// Included in all non Windows scripts
//
"unix": {
"KEY": "value"
},
// Included in all non Windows (except OSX) scripts
//
"linux": {
"KEY": "value"
},
// Included only in OSX scripts
//
"osx": {
"KEY": "value"
},
// Included in Windows scripts
//
"windows": {
"KEY": "value"
}
},
// Maven coordinates: groupId.
// If left undefined, will use `#{project.java.groupId}`.
//
"groupId": "com.acme",
// Maven coordinates: artifactId.
// If left undefined, will use `#{project.java.artifactId}`.
//
"artifactId": "app",
// The minimum Java version required by consumers to run the application.
// If left undefined, will use `#{project.java.version}`.
//
"version": "8",
// Identifies the project as being member of a multi-project build.
// If left undefined, will use `#{project.java.multiProject}`.
//
"multiProject": false,
// Additional properties used when evaluating templates.
//
"extraProperties": {
// Key will be capitalized and prefixed with `java`, i.e, `javaFoo`.
"foo": "bar"
}
},
// Inputs as a Java Archive
//
"javaArchive": {
// Path to the source Java archive.
//
"path": "path/to/app-1.0.0.zip",
// Name of the main JAR.
// Defaults to `{{projectName}}-{{projectVersion}}.jar`.
//
"mainJarName": "{{projectName}}-{{projectVersion}}.jar",
// Path within archive containing JAR files.
// Defaults to `lib`.
//
"libDirectoryName": "lib"
},
// Directory with file templates used to prepare the assembler.
// Defaults to `src/jreleaser/assemblers/#$#{distribution.name}/jlink`.
// If specified, path must exist.
//
"templateDirectory": "path/to/jlink/templates",
// List of template files to be skipped.
// Value may be an exact match or a regex.
//
"skipTemplates": [
"README.md.tpl"
],
// Defines a list of additional files as artifacts.
// These files will be added to the assembled archive.
//
"artifacts": [
{
"path": "path/to/file"
},
{
"path": "path/to/another_file",
"transform": "path/inside/archive"
},
{
"path": "path/to/platform/specific/file",
"platform": "osx-x86_64"
}
] ,
// Defines a list of additional files as globs.
// These files will be added to the assembled archive.
//
"files": [
{
// The pattern to use.
// May use glob or regex pattern syntax.
//
"pattern": "path/to/**/*.txt"
}
],
// Defines a list of additional files as filesets.
// These files will be added to the assembled archive.
//
"fileSets": [
{
// The input directory to copy files from.
//
"input": "path/to/input/directory",
// The target path inside the archive.
// If left undefined, defaults to the root of the archive.
//
"output": "path/to/archive/entry",
// Fail if the given `input` does not exist.
// Defaults to `true`.
//
"failOnMissingInput": false,
// A set of files and directory to include.
//
"includes": ["name_or_regex"],
// A set of files and directory to exclude.
//
"excludes": ["name_or_regex"],
// Additional properties used when evaluating templates.
//
"extraProperties": {
// Key will be capitalized and prefixed with `artifact`, i.e, `artifactFoo`.
"foo": "bar"
}
}
],
//
"swid": {
// Tags require a name.
//
"mytag": {
// Enables or disables the tag.
// Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
// Defaults to `NEVER`.
//
"active": "ALWAYS",
// Reference to a common tag.
//
"tagRef": "swid-tag",
// Path where the tag file will be placed.
// Defaults to `SWIDTAG`.
//
"path": "SWID",
// A globally unique identifier and should be assigned a GUID reference.
// Defaults to a UUID generated with `groupId`, `artifactId`, `version`, `vendor`.
//
"tagId": "c526ec37-2715-328e-8bbc-4eb5a9f47c98",
// Indicates if a specific release of a software product has more than one tag that can represent that specific release.
// Defaults to `1`.
//
"tagVersion": 2,
// Language used in the tag document.
// Defaults to `en-US`.
//
"lang": "de",
// If this SWID tag is a collection of information that describes the pre-installation data of software component.
// Defaults to `false`.
//
"corpus": true,
// If this SWID tag describes a product patch or modification to a different software element.
// Defaults to `false`.
//
"patch": false,
// List of organizations related to the software component referenced by this SWID tag.
//
"entities": [
{
// name of the organization claiming a particular role in the SWID tag.
//
"name": "Acme",
// URI of the claiming organization.
// Defaults to `http://invalid.unavailable`.
//
"regid": "https://acme.com",
// The relationship between this organization and this tag e.g. tag, `softwareCreator`, `licensor`, `tagCreator`, etc.
// The role of `tagCreator` is required for every SWID tag. May include any role value, but the pre-defined roles
// include: `aggregator`, `distributor`, `licensor`, `softwareCreator`, `tagCreator`.
// Other roles will be defined as the market uses the SWID tags.
// Defaults to [`tagCreator`, `softwareCreator`].
//
"roles": [
"tagCreator",
"softwareCreator"
]
}
]
}
}
}
}
}
}
<jreleaser>
<!--
-->
<assemble>
<!--
-->
<jlink>
<!--
Assemblers require a name.
-->
<app>
<!--
Enables or disables the distribution.
Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
Defaults to `ALWAYS`.
-->
<active>ALWAYS</active>
<!--
Export the assembled artifacts as a matching named distribution.
Defaults to `true`.
-->
<exported>true</exported>
<!--
The stereotype of this assembler.
Supported values are [`NONE`, `CLI`, `DESKTOP`, `WEB`, `MOBILE`].
Defaults to `#{project.stereotype}`.
-->
<stereotype>CLI</stereotype>
<!--
Additional properties used when evaluating templates.
-->
<extraProperties>
<!--
Key will be capitalized and prefixed with `jlink`, i.e, `jlinkFoo`.
-->
<foo>bar</foo>
</extraProperties>
<!--
-->
<platform>
<!--
Key value pairs.
Keys match a full platform or an os.name, os.arch.
Same rules apply as in Platform.
-->
<replacements>
<osx-x86_64>mac</osx-x86_64>
<aarch_64>aarch64</aarch_64>
<x86_64>amd64</x86_64>
<linux_musl>alpine</linux_musl>
</replacements>
</platform>
<!--
Name of the executable launcher.
If left undefined, will use `#{distribution.name}`.
-->
<executable>app</executable>
<!--
Name of the generated image.
If left undefined, will use
`#{project.java.groupId}.#{project.java.artifactId}-#{project.version}`.
Generated artifacts always have the platform as suffix.
-->
<imageName>app-{{projectVersion}}</imageName>
<!--
Name transformation of the generated image.
Transformed artifacts always have the platform as suffix.
-->
<imageNameTransform>app</imageNameTransform>
<!--
Archive format to use.
Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TBZ2`, `TGZ`, `TXZ`].
Defaults to `ZIP`.
-->
<archiveFormat>ZIP</archiveFormat>
<!--
List of module names.
Overrides modules found by jdeps.
Setting any values here automatically disables jdeps.
-->
<moduleNames>
<moduleName>java.base</moduleName>
<moduleName>com.acme.demo</moduleName>
</moduleNames>
<!--
List of additional module names.
Additional required modules but not detected by jdeps.
-->
<additionalModuleNames>
<additionalModuleName>jdk.crypto.ec</additionalModuleName>
<additionalModuleName>jdk.localedata</additionalModuleName>
</additionalModuleNames>
<!--
List of JDKs for generating cross-platform images.
-->
<targetJdks>
<targetJdk>
<path>path/to/jdk</path>
<platform>osx-x86_64</platform>
</targetJdk>
<targetJdk>
<path>path/to/jdk</path>
<platform>linux-x86_64</platform>
</targetJdk>
</targetJdks>
<!--
The JDK to use.
If undefined, will find a matching JDK.
-->
<jdk>
<path>path/to/jdk</path>
<platform>linux-x86_64</platform>
</jdk>
<!--
Configuration flags for Jdeps
-->
<jdeps>
<!--
Enables or disables jdeps
If disabled then [`java.base`] is set as default value for `moduleNames`,
you may define an explicit value for `moduleNames` or use `additionalModuleNames`.
Defaults to `true`
-->
<enabled>true</enabled>
<!--
Specifies the version when processing multi-release jar files.
Value should be integer >= 9 or `base`.
Defaults to empty
-->
<multiRelease>base</multiRelease>
<!--
Ignore missing dependences.
Defaults to `false`
-->
<ignoreMissingDeps>true</ignoreMissingDeps>
<!--
Use wildcard expression in classpath.
Defaults to `true`
-->
<useWildcardInPath>false</useWildcardInPath>
<!--
JARs or classes used to limit the module search
Must be defined as paths.
Defaults to empty.
-->
<targets>
<target>${project.build.directory}/classes/com/acme/Main.class</target>
</targets>
</jdeps>
<!--
A list of build arguments.
Defaults are shown.
-->
<args>
<arg>--no-header-files</arg>
<arg>--no-man-pages</arg>
<arg>--compress zip-9</arg>
<arg>--strip-debug</arg>
</args>
<!--
Copy main and input JARs into archive.
Defaults to `true`.
-->
<copyJars>true</copyJars>
<!--
-->
<options>
<!--
Timestamp to use for each entry.
Must follow ISO-8601 +HH:MM timezone offset.
Example: 2023-03-08T12:56:33.024578+01:00
Defaults to timestamp for latest git commit or current time.
-->
<timestamp>2020-01-01T00:00:00.000000+00:00</timestamp>
<!--
Set longFileMode for tar archives.
Possible values are [`ERROR`, `GNU`, `POSIX`, `TRUNCATE`].
Defaults to `ERROR`.
-->
<longFileMode>POSIX</longFileMode>
<!--
Set bigNumberMode for tar archives.
Possible values are [`ERROR`, `GNU`, `POSIX`].
Defaults to `ERROR`.
-->
<bigNumberMode>POSIX</bigNumberMode>
</options>
<!--
The executable JAR that contains the application.
-->
<mainJar>
<path>path/to/app.jar</path>
</mainJar>
<!--
Defines a list of additional JARs as globs.
-->
<jars>
<jar>
<!--
The pattern to use.
May use glob or regex pattern syntax.
-->
<pattern>path/to/**/*.jar</pattern>
</jar>
</jars>
<!--
-->
<java>
<!--
Name of main module (if any).
Define only if the application is modular.
-->
<mainModule>com.acme.demo</mainModule>
<!--
The application's entry point.
If left undefined, will use `#{project.java.mainClass}`.
-->
<mainClass>com.acme.Main</mainClass>
<!--
Options to pass to the Java runtime
-->
<jvmOptions>
<!--
Included in all scripts
-->
<universal>-Dprop=value</universal>
<!--
Included in all non Windows scripts
-->
<unix>-Dprop=value</unix>
<!--
Included in all non Windows (except OSX) scripts
-->
<linux>-Dprop=value</linux>
<!--
Included only in OSX scripts
-->
<osx>-Dprop=value</osx>
<!--
Included in Windows scripts
-->
<windows>-Dprop=value</windows>
</jvmOptions>
<!--
Environment variables used in launch scripts.
-->
<environmentVariables>
<!--
Included in all scripts
-->
<universal>
<KEY>value</KEY>
</universal>
<!--
Included in all non Windows scripts
-->
<unix>
<KEY>value</KEY>
</unix>
<!--
Included in all non Windows (except OSX) scripts
-->
<linux>
<KEY>value</KEY>
</linux>
<!--
Included only in OSX scripts
-->
<osx>
<KEY>value</KEY>
</osx>
<!--
Included in Windows scripts
-->
<windows>
<KEY>value</KEY>
</windows>
</environmentVariables>
<!--
Maven coordinates>groupId.
If left undefined, will use `#{project.java.groupId}`.
-->
<groupId>com.acme</groupId>
<!--
Maven coordinates>artifactId.
If left undefined, will use `#{project.java.artifactId}`.
-->
<artifactId>app</artifactId>
<!--
The minimum Java version required by consumers to run the application.
If left undefined, will use `#{project.java.version}`.
-->
<version>8</version>
<!--
Identifies the project as being member of a multi-project build.
If left undefined, will use `#{project.java.multiProject}`.
-->
<multiProject>false</multiProject>
<!--
Additional properties used when evaluating templates.
-->
<extraProperties>
<!--
Key will be capitalized and prefixed with `java`, i.e, `javaFoo`.
-->
<foo>bar</foo>
</extraProperties>
</java>
<!--
Inputs as a Java Archive
-->
<javaArchive>
<!--
Path to the source Java archive.
-->
<path>path/to/app-1.0.0.zip</path>
<!--
Name of the main JAR.
Defaults to `{{projectName}}-{{projectVersion}}.jar`.
-->
<mainJarName>{{projectName}}-{{projectVersion}}.jar</mainJarName>
<!--
Path within archive containing JAR files.
Defaults to `lib`.
-->
<libDirectoryName>lib</libDirectoryName>
</javaArchive>
<!--
Directory with file templates used to prepare the assembler.
Defaults to `src/jreleaser/assemblers/#{distribution.name}/jlink`.
If specified, path must exist.
-->
<templateDirectory>path/to/jlink/templates</templateDirectory>
<!--
List of template files to be skipped.
Value may be an exact match or a regex.
-->
<skipTemplates>
<skipTemplate>README.md.tpl</skipTemplate>
</skipTemplates>
<!--
Defines a list of additional files as artifacts.
These files will be added to the assembled archive.
-->
<artifacts>
<artifact>
<path>path/to/file</path>
</artifact>
<artifact>
<path>path/to/another_file</path>
<transform>path/inside/archive</transform>
</artifact>
<artifact>
<path>path/to/platform/specific/file</path>
<platform>osx-x86_64</platform>
</artifact>
</artifacts>
<!--
Defines a list of additional files as globs.
These files will be added to the assembled archive.
-->
<files>
<file>
<!--
The pattern to use.
May use glob or regex pattern syntax.
-->
<pattern>path/to/**/*.txt</pattern>
</file>
</files>
<!--
Defines a list of additional files as filesets.
These files will be added to the assembled archive.
-->
<fileSets>
<fileSet>
<!--
The input directory to copy files from.
-->
<input>path/to/input/directory</input>
<!--
The target path inside the archive.
If left undefined, defaults to the root of the archive.
-->
<output>path/to/archive/entry</output>
<!--
Fail if the given `input` does not exist.
Defaults to `true`.
-->
<failOnMissingInput>false</failOnMissingInput>
<!--
A set of files and directory to include.
-->
<includes>
<include>name_or_regex</include>
</includes>
<!--
A set of files and directory to exclude.
-->
<excludes>
<exclude>name_or_regex</exclude>
</excludes>
<!--
Additional properties used when evaluating templates.
-->
<extraProperties>
<!--
Key will be capitalized and prefixed with `artifact`, i.e, `artifactFoo`.
-->
<foo>bar</foo>
</extraProperties>
</fileSet>
</fileSets>
<!--
-->
<swid>
<!--
Tags require a name.
-->
<mytag>
<!--
Enables or disables the tag.
Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
Defaults to `NEVER`.
-->
<active>ALWAYS</active>
<!--
Reference to a common tag.
-->
<tagRef>swid-tag</tagRef>
<!--
Path where the tag file will be placed.
Defaults to `SWIDTAG`.
-->
<path>SWID</path>
<!--
A globally unique identifier and should be assigned a GUID reference.
Defaults to a UUID generated with `groupId`, `artifactId`, `version`, `vendor`.
-->
<tagId>c526ec37-2715-328e-8bbc-4eb5a9f47c98</tagId>
<!--
Indicates if a specific release of a software product has more than one tag that can represent that specific release.
Defaults to `1`.
-->
<tagVersion>2</tagVersion>
<!--
Language used in the tag document.
Defaults to `en-US`.
-->
<lang>de</lang>
<!--
If this SWID tag is a collection of information that describes the pre-installation data of software component.
Defaults to `false`.
-->
<corpus>true</corpus>
<!--
If this SWID tag describes a product patch or modification to a different software element.
Defaults to `false`.
-->
<patch>false</patch>
<!--
List of organizations related to the software component referenced by this SWID tag.
-->
<entities>
<entity>
<!--
name of the organization claiming a particular role in the SWID tag.
-->
<name>Acme</name>
<!--
URI of the claiming organization.
Defaults to `http://invalid.unavailable`.
-->
<regid>https://acme.com</regid>
<!--
The relationship between this organization and this tag e.g. tag, `softwareCreator`, `licensor`, `tagCreator`, etc.
The role of `tagCreator` is required for every SWID tag. May include any role value, but the pre-defined roles
include: `aggregator`, `distributor`, `licensor`, `softwareCreator`, `tagCreator`.
Other roles will be defined as the market uses the SWID tags.
Defaults to [`tagCreator`, `softwareCreator`].
-->
<roles>
<role>tagCreator</role>
<role>softwareCreator</role>
</roles>
</entity>
</entities>
</swid-tag>
</swid>
</app>
</jlink>
</assemble>
</jreleaser>
jreleaser {
//
assemble {
//
jlink {
// Assemblers require a name.
//
app {
// Enables or disables the assembler.
// Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
// Defaults to `NEVER`.
//
active = 'ALWAYS'
// Export the assembled artifacts as a matching named distribution.
// Defaults to `true`.
//
exported = true
// The stereotype of this assembler.
// Supported values are [`NONE`, `CLI`, `DESKTOP`, `WEB`, `MOBILE`].
// Defaults to `#{project.stereotype}`.
//
stereotype = 'CLI'
// Additional properties used when evaluating templates.
// Key will be capitalized and prefixed with `jlink`, i.e, `jlinkFoo`.
//
extraProperties.put('foo', 'bar')
//
platform {
// Key value pairs.
// Keys match a full platform or an os.name, os.arch.
// Same rules apply as in Platform.
//
replacements = [
'osx-x86_64': 'mac',
aarch_64: 'aarch64',
x86_64: 'amd64',
linux_musl: 'alpine'
]
}
// Name of the executable launcher.
// If left undefined, will use `#{assembler.name}`.
//
executable = 'app'
// Name of the generated image.
// If left undefined, will use
// `#{project.java.groupId}.#{project.java.artifactId}-#{project.version}`.
// Generated artifacts always have the platform as suffix.
//
imageName = 'app-{{projectVersion}}'
// Name transformation of the generated image.
// Transformed artifacts always have the platform as suffix.
//
imageNameTransform = 'app-{{projectEffectiveVersion}}'
// Archive format to use.
// Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TBZ2`, `TGZ`, `TXZ`].
// Defaults to `ZIP`.
//
archiveFormat = 'ZIP'
// List of module names.
// Overrides modules found by jdeps.
// Setting any values here automatically disables jdeps.
//
moduleNames = [
'java.base',
'com.acme.demo'
]
// List of additional module names.
// Additional required modules but not detected by jdeps.
//
additionalModuleNames = [
'jdk.crypto.ec',
'jdk.localedata'
]
// List of JDKs for generating cross-platform images.
//
targetJdk {
path = 'path/to/jdk'
platform = 'osx-x86_64'
}
targetJdk {
path = 'path/to/jdk'
platform = 'linux-x86_64'
}
// The JDK to use.
// If undefined, will find a matching JDK.
//
jdk {
path = 'path/to/jdk'
platform = 'linux-x86_64'
}
// Configuration flags for Jdeps
//
jdeps {
// Enables or disables jdeps
// If disabled then [`java.base`] is set as default value for `moduleNames`,
// you may define an explicit value for `moduleNames` or use `additionalModuleNames`.
// Defaults to `true`
//
enabled = true
// Specifies the version when processing multi-release jar files.
// Value should be integer >= 9 or `base`.
// Defaults to empty
//
multiRelease = 'base'
// Ignore missing dependences.
// Defaults to `false`
//
ignoreMissingDeps = true
// Use wildcard expression in classpath.
// Defaults to `true`
//
useWildcardInPath = false
// JARs or classes used to limit the module search
// Must be defined as paths.
// Defaults to empty.
//
targets = [ 'build/classes/com/acme/Main.class' ]
}
// A list of build arguments.
// Defaults are shown.
//
arg('--install-exit-handlers')
arg('--no-header-files')
arg('--no-man-pages')
arg('--compress zip-9')
arg('--strip-debug')
// Copy main and input JARs into archive.
// Defaults to `true`.
//
copyJars = true
//
options {
// Timestamp to use for each entry.
// Must follow ISO-8601 + timezone offset.
// Example: 2023-03-08T12:56:33.024578+01:00
// Defaults to timestamp for latest git commit or current time.
//
timestamp = '2020-01-01T00:00:00.000000+00:00'
// Set longFileMode for tar archives.
// Possible values are [`ERROR`, `GNU`, `POSIX`, `TRUNCATE`].
// Defaults to `ERROR`.
//
longFileMode = 'POSIX'
// Set bigNumberMode for tar archives.
// Possible values are [`ERROR`, `GNU`, `POSIX`].
// Defaults to `ERROR`.
//
bigNumberMode = 'POSIX'
}
// The executable JAR that contains the application.
//
mainJar {
path = 'path/to/app.jar'
}
// Defines a list of additional JARs as globs.
//
jars {
// The pattern to use.
// May use glob or regex pattern syntax.
//
pattern = 'path/to/**/*.jar'
}
//
java {
// Name of main module (if any).
// Define only if the application is modular.
//
mainModule = 'com.acme.demo'
// The application's entry point.
// If left undefined, will use `#{project.java.mainClass}`.
//
mainClass = 'com.acme.Main'
// Options to pass to the Java runtime
//
jvmOptions {
// Included in all scripts
//
universal('-Dprop=value')
// Included in all non Windows scripts
//
unix('-Dprop=value')
// Included in all non Windows (except OSX) scripts
//
linux('-Dprop=value')
// Included only in OSX scripts
//
osx('-Dprop=value')
// Included in Windows scripts
//
windows('-Dprop=value')
}
// Environment variables used in launch scripts.
//
environmentVariables {
// Included in all scripts
//
universal('KEY', 'value')
// Included in all non Windows scripts
//
unix('KEY', 'value')
// Included in all non Windows (except OSX) scripts
//
linux('KEY', 'value')
// Included only in OSX scripts
//
osx('KEY', 'value')
// Included in Windows scripts
//
windows('KEY', 'value')
}
// Maven coordinates = groupId.
// If left undefined, will use `#{project.java.groupId}`.
//
groupId = 'com.acme'
// Maven coordinates = artifactId.
// If left undefined, will use `#{project.java.artifactId}`.
//
artifactId = 'app'
// The minimum Java version required by consumers to run the application.
// If left undefined, will use `#{project.java.version}`.
//
version = '8'
// Identifies the project as being member of a multi-project build.
// If left undefined, will use `#{project.java.multiProject}`.
//
multiProject = false
// Additional properties used when evaluating templates.
// Key will be capitalized and prefixed with `java`, i.e, `javaFoo`.
//
extraProperties.put('foo', 'bar')
}
// Inputs as a Java Archive
//
javaArchive {
// Path to the source Java archive.
//
path = 'path/to/app-1.0.0.zip'
// Name of the main JAR.
// Defaults to `{{projectName}}-{{projectVersion}}.jar`.
//
mainJarName = '{{projectName}}-{{projectVersion}}.jar'
// Path within archive containing JAR files.
// Defaults to `lib`.
//
libDirectoryName = 'lib'
}
// Directory with file templates used to prepare the assembler.
// Defaults to `src/jreleaser/assemblers/#{distribution.name}/jlink`.
// If specified, path must exist.
//
templateDirectory = 'path/to/jlink/templates'
// List of template files to be skipped.
// Value may be an exact match or a regex.
//
skipTemplate('README.md.tpl')
// Defines a list of additional files as artifacts.
// These files will be added to the assembled archive.
//
artifact {
path = 'path/to/file'
}
artifact {
path = 'path/to/another_file'
transform = 'path/inside/archive'
}
artifact {
path = 'path/to/platform/specific/file'
platform = 'osx-x86_64'
}
// Defines a list of additional files as globs.
// These files will be added to the assembled archive.
//
files {
// The pattern to use.
// May use glob or regex pattern syntax.
//
pattern = 'path/to/**/*.txt'
}
// Defines a list of additional files as filesets.
// These files will be added to the assembled archive.
//
fileSet {
// The input directory to copy files from.
//
input = 'path/to/input/directory'
// The target path inside the archive.
// If left undefined, defaults to the root of the archive.
//
output = 'path/to/archive/entry'
// Fail if the given `input` does not exist.
// Defaults to `true`.
//
failOnMissingInput = false
// A set of files and directory to include.
//
includes = ['name_or_regex']
// A set of files and directory to exclude.
//
excludes = ['name_or_regex']
// Additional properties used when evaluating templates.
// Key will be capitalized and prefixed with `artifact`, i.e, `artifactFoo`.
//
extraProperties.put('foo', 'bar')
}
//
swid {
// Tags require a name.
//
mytag {
// Enables or disables the tag.
// Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
// Defaults to `NEVER`.
//
active = 'ALWAYS'
// Reference to a common tag.
//
tagRef = 'swid-tag'
// Path where the tag file will be placed.
// Defaults to `SWIDTAG`.
//
path = 'SWID'
// A globally unique identifier and should be assigned a GUID reference.
// Defaults to a UUID generated with `groupId`, `artifactId`, `version`, `vendor`.
//
tagId = 'c526ec37-2715-328e-8bbc-4eb5a9f47c98'
// Indicates if a specific release of a software product has more than one tag that can represent that specific release.
// Defaults to `1`.
//
tagVersion = 2
// Language used in the tag document.
// Defaults to `en-US`.
//
lang = 'de'
// If this SWID tag is a collection of information that describes the pre-installation data of software component.
// Defaults to `false`.
//
corpus = true
// If this SWID tag describes a product patch or modification to a different software element.
// Defaults to `false`.
//
patch = false
// List of organizations related to the software component referenced by this SWID tag.
//
entity {
// name of the organization claiming a particular role in the SWID tag.
//
name = 'Acme'
// URI of the claiming organization.
// Defaults to `http://invalid.unavailable`.
//
regid = 'https://acme.com'
// The relationship between this organization and this tag e.g. tag, `softwareCreator`, `licensor`, `tagCreator`, etc.
// The role of `tagCreator` is required for every SWID tag. May include any role value, but the pre-defined roles
// include: `aggregator`, `distributor`, `licensor`, `softwareCreator`, `tagCreator`.
// Other roles will be defined as the market uses the SWID tags.
// Defaults to [`tagCreator`, `softwareCreator`].
//
role('tagCreator')
role('softwareCreator')
}
}
}
}
}
}
}
Environment
When not explicitly set, the value of the following properties may be resolved from an environment variable or a system property as shown in the table. The system property takes precedence over the environment variable.
System Property | Environment Variable |
---|---|
active |
|
jreleaser.assemble.jlink.${name}.active |
JRELEASER_ASSEMBLE_JLINK_${name}_ACTIVE |
Inputs
Jlink assemblers would typically be configured using the mainJar
and jars
properties, with any additional supporting
files defined as required with artifacts
, files
, and fileSets
. It’s also possible to set javaArchive
, in which case
an archive that follows the structure of a Java Binary distribution is expected. You
may create such archive using the Java Archive assembler or a plugin of your preferred build tool
of choice.
Archive Format
By default all archives use the Zip format, however you may change this by setting and extra property named archiveFormat
on a given targetJdk
. the Jlink assembler will use it as a hint to select the appropriate archiving format, for example
here’s how the format may be changed for archives that target Linux platforms:
assemble:
jlink:
app:
active: ALWAYS
targetJdks:
- path: '{{jdkPathPrefix}}/zulu17Osx/{{jdkFilePrefix}}-macosx_x64/zulu-17.jdk/Contents/Home'
platform: 'osx-x86_64'
- path: '{{jdkPathPrefix}}/zulu17Linux/{{jdkFilePrefix}}-linux_x64'
platform: 'linux-x86_64'
extraProperties:
archiveFormat: TGZ
- path: '{{jdkPathPrefix}}/zulu17LinuxMusl/{{jdkFilePrefix}}-linux_musl_x64'
platform: 'linux_musl-x86_64'
extraProperties:
archiveFormat: TGZ
- path: '{{jdkPathPrefix}}/zulu17Windows/{{jdkFilePrefix}}-win_x64'
platform: 'windows-x86_64'
Supported values for the archiveFormat
property are [ZIP
, TAR
, TAR_BZ2
, TAR_GZ
, TAR_XZ
, TBZ2
, TGZ
, TXZ
], with ZIP
being the
default if left unspecified.
Substitute ${name} for the value of the named instance. |
Space (' '), underscore (_
), and dash (-
) will be replaced by dot (.
) to separate tokens in the System property.
Space (' '), dash (-
), and dot (.
) will be replaced by underscore (_
) to separate tokens in the environment variable,
such that:
${name} | System Property | Environment Variable |
---|---|---|
foobar |
|
|
fooBar |
|
|
foo bar |
|
|
foo-bar |
|
|
foo_bar |
|
|
foo.bar |
|
|
JDKs
You may specify a value for both jdk
and targetJdks
, either, or none. The following rules apply when resolving which
JDKs will be used to generate custom Java runtimes:
-
If both
jdk
andtargetJdks
are specified then they must match the same major version. -
If only
jdk
is specified then thetargetJdks
will contain a single entry matching the givenjdk
. -
If no
jdk
is specified then a matching JDK will be searched intargetJdks
. -
If no match is found in rule #3 then the currently executing JDK will be used leading to the same result as rule #2.
Paths for jdk
and targetJdks
must exist in the file system. You may use the
jdks-maven-plugin or
jdks-gradle-plugin to download required JDKs.
Templates
The default location for templates is:
src/jreleaser/assemblers/<distribution-name>/jlink
The following list shows the filenames that may be used to override default templates:
-
bin/launcher.tpl
-
bin/launcher.bat.tpl
Any additional files found in the template directories will be copied as is unless their filename ends with .tpl
in
which case Name Templates substitution will take place.
Skip Templates
You may skip any template files by defining a set of skip rules in the skipTemplates
property. For example, you may use
any of these expressions to skip a template named README.md.tpl
:
-
README.md.tpl
: matches the full template name -
README.md
: matches the transformed template name -
README.*
: matches using a regex
Additional Files
There are several ways to define additional files that may be handled by this assembler.
Templates
-
You may use Name Templates inside the files to be copied.
-
They retain directory structure that is, a template found at
{templateDirectory}/foo.txt.tpl
will be copied asfoo.txt
while a template such as{templateDirectory}/docs/bar.md.tpl
will be copied todocs/bar.md
.
FileSets
-
May use globs or regexes to define files to be included from a starting directory.
-
They retain directory structure.
-
May rename the target parent directory.
Files
-
May use globs or regexes to define files to be included from a starting directory.
-
They do not retain directory structure. Only filenames are copied.
Artifacts
-
They do not retain directory structure by default. An artifact with
path
set tobin/launcher.sh
will be copied tolauncher.sh
. -
May use the
transform
property to define the target path. An artifact withpath
set tobin/launcher.sh
andtransform
set tobin/{{projectName}}
will be copied tobin/app
[assumingprojectName
resolves toapp
]. -
May use the
platform
property to filter files per matching platform. An artifact withplatform
set towindows-x86_64
will only be copied when the matching platform is compatible withwindows-x86_64
. -
Artifacts without an explicit
platform
won’t be filtered.