Archive
Creates a binary distribution archive.
Legend:
-
required
-
optional
-
may use environment variable
-
accepts Name Templates
#
assemble:
#
archive:
# 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 `archive`, i.e, `archiveFoo`.
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 archive.
# If left undefined, will use {{distributionName}}-{{projectVersion}}.
#
archiveName: 'app-{{projectVersion}}'
# The distribution type.
# Used to determine packager templates.
# Supported values are: [`JAVA_BINARY`, `SINGLE_JAR`, `JLINK`, `BINARY`, `NATIVE_PACKAGE`].
# Defaults to `BINARY`.
#
distributionType: JAVA_BINARY
# Attach the current platform to the archiveName.
# Defaults to `false`.
#
attachPlatform: true
# Set of archive formats to use.
# Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TAR_ZST`, `TBZ2`, `TGZ`, `TXZ`].
#
formats:
- ZIP
- TGZ
#
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
# Assemblers require a name.
#
[assemble.archive.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 `archive`, i.e, `archiveFoo`.
# Key value pairs.
# Keys match a full platform or an os.name, os.arch.
# Same rules apply as in Platform.
#
[assemble.archive.app.platform.replacements]
osx-x86_64 = "mac"
aarch_64 = "aarch64"
x86_64 = "amd64"
linux_musl = "alpine"
# Name of the archive.
# If left undefined, will use {{distributionName}}-{{projectVersion}}.
#
archiveName = "app-{{projectVersion}}"
# The distribution type.
# Used to determine packager templates.
# Supported values are: [`JAVA_BINARY`, `SINGLE_JAR`, `JLINK`, `BINARY`, `NATIVE_PACKAGE`].
# Defaults to `BINARY`.
#
distributionType = "JAVA_BINARY"
# Attach the current platform to the archiveName.
#
# Defaults to `false`.
attachPlatform = true
# Set of archive formats to use.
# Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TAR_ZST`, `TBZ2`, `TGZ`, `TXZ`].
#
formats = [ "ZIP", "TGZ"]
#
[[assemble.archive.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.archive.app.fileSets.extraProperties]]
# Key will be capitalized and prefixed with `artifact`, i.e, `artifactFoo`.
foo: bar
{
//
"assemble": {
//
"archive": {
// 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 `archive`, i.e, `archiveFoo`.
"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 archive.
// If left undefined, will use {{distributionName}}-{{projectVersion}}.
//
"archiveName": "app-{{projectVersion}}",
// The distribution type.
// Used to determine packager templates.
// Supported values are: [`JAVA_BINARY`, `SINGLE_JAR`, `JLINK`, `BINARY`, `NATIVE_PACKAGE`].
// Defaults to `BINARY`.
//
"distributionType": "JAVA_BINARY",
// Attach the current platform to the archiveName.
// Defaults to `false`.
//
"attachPlatform": true,
// Set of archive formats to use.
// Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TAR_ZST`, `TBZ2`, `TGZ`, `TXZ`].
//
"formats": [
"ZIP",
"TGZ"
],
//
"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"
}
}
]
}
}
}
}
<jreleaser>
<!--
-->
<assemble>
<!--
-->
<archive>
<!--
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 `archive`, i.e, `archiveFoo`.
-->
<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 archive.
If left undefined, will use {{distributionName}}-{{projectVersion}}.
-->
<archiveName>app-{{projectVersion}}</archiveName>
<!--
The distribution type.
Used to determine packager templates.
Supported values are>[`JAVA_BINARY`, `SINGLE_JAR`, `JLINK`, `BINARY`, `NATIVE_PACKAGE`].
Defaults to `BINARY`.
-->
<distributionType>JAVA_BINARY</distributionType>
<!--
Attach the current platform to the archiveName.
Defaults to `false`.
-->
<attachPlatform>true</attachPlatform>
<!--
Set of archive formats to use.
Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TAR_ZST`, `TBZ2`, `TGZ`, `TXZ`].
-->
<formats>
<format>ZIP</format>
<format>TGZ</format>
</formats>
<!--
-->
<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>
</app>
</archive>
</assemble>
</jreleaser>
jreleaser {
//
assemble {
//
archive {
// 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 `archive`, i.e, `archiveFoo`.
//
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 archive.
// If left undefined, will use {{distributionName}}-{{projectVersion}}.
//
archiveName = 'app-{{projectVersion}}'
// The distribution type.
// Used to determine packager templates.
// Supported values are = [`JAVA_BINARY`, `SINGLE_JAR`, `JLINK`, `BINARY`, `NATIVE_PACKAGE`].
// Defaults to `BINARY`.
//
distributionType = 'JAVA_BINARY'
// Attach the current platform to the archiveName.
// Defaults to `false`.
//
attachPlatform = true
// Set of archive formats to use.
// Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TAR_ZST`, `TBZ2`, `TGZ`, `TXZ`].
//
formats = [
'ZIP',
'TGZ'
]
//
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')
}
}
}
}
}
Example
Given the following file structure
Unix
.
├── BUILD
├── LICENSE
├── README
└── target
└── release
└── app
Windows
.
├── BUILD
├── LICENSE
├── README
└── target
└── release
└── app.exe
And this assembly configuration
project:
version: 1.0.0
assemble:
archive:
app:
active: ALWAYS
attachPlatform: true
fileSets:
- input: '.'
includes:
- 'LICENSE'
- 'README'
- input: 'target/release'
output: 'bin'
includes: [ 'app{.exe,}' ]
[project]
version = "1.0.0"
[assemble.archive.app]
active = "ALWAYS"
attachPlatform = true
[[assemble.archive.app.fileSets]]
input = "."
includes = ["LICENSE", "README"]
[[assemble.archive.app.fileSets]]
input = "target/release"
output = "bin"
includes = [ "app{.exe,}" ]
{
"project": {
"version": "1.0.0"
},
"assemble": {
"archive": {
"app": {
"active": "ALWAYS",
"attachPlatform": true,
"fileSets": [
{
"input": ".",
"includes": ["LICENSE", "README"]
},
{
"input": "target/release",
"output": "bin",
"includes": [ "app{.exe,}" ]
}
]
}
}
}
}
<jreleaser>
<project>
<version>1.0.0</version>
</project>
<assemble>
<archive>
<app>
<active>ALWAYS</active>
<attachPlatform>true</attachPlatform>
<fileSets>
<fileSet>
<input>.</input>
<includes>
<include>LICENSE</include>
<include>README</include>
</includes>
</fileSet>
<fileSet>
<input>target/release</input>
<output>bin</output>
<includes>
<include>app{.exe,}</include>
</includes>
</fileSet>
</fileSets>
</app>
</archive>
</assemble>
</jreleaser>
jreleaser {
project {
version = '1.0.0'
}
assemble {
archive {
app {
active = 'ALWAYS'
attachPlatform = true
fileSet {
input = '.'
includes = ['LICENSE', 'README']
}
fileSet {
input = 'target/release'
output = 'bin'
includes = [ 'app{.exe,}' ]
}
}
}
}
}
When run on Linux, macOs, and Windows on intel chips results in the following assembled Zip archives:
app-1.0.0-linux-x86_64.zip
app-1.0.0-linux-x86_64
├── LICENSE
├── README
└── bin
└── app
app-1.0.0-osx-x86_64.zip
app-1.0.0-osx-x86_64
├── LICENSE
├── README
└── bin
└── app
app-1.0.0-windows-x86_64.zip
app-1.0.0-wndows-x86_64
├── LICENSE
├── README
└── bin
└── app.exe