diff --git a/docs/modules/ROOT/pages/distributions/java-binary.adoc b/docs/modules/ROOT/pages/distributions/java-binary.adoc
index b51096974..41c78cbc9 100644
--- a/docs/modules/ROOT/pages/distributions/java-binary.adoc
+++ b/docs/modules/ROOT/pages/distributions/java-binary.adoc
@@ -39,7 +39,7 @@ We recommend using the following plugins to create suitable Java binary distribu
* link:https://docs.gradle.org/current/userguide/application_plugin.html[application] plugin: generates distribution
files that follow the expected structure. Also, packages the distribution as a Zip or Tar.
-Alternatively, you may also configure a xref:configuration:assemble/archive.adoc[] assembler to create an archive.
+Alternatively, you may also configure a xref:configuration:assemble/java-archive.adoc[] assembler to create an archive.
== Packager Support
diff --git a/docs/modules/ROOT/pages/integrations.adoc b/docs/modules/ROOT/pages/integrations.adoc
index 590b0dbe0..ac3fb1c67 100644
--- a/docs/modules/ROOT/pages/integrations.adoc
+++ b/docs/modules/ROOT/pages/integrations.adoc
@@ -16,6 +16,7 @@ Files may be downloaded from the following services:
Distributions may be assembled using your build tool of choice, also with any of the following assemblers:
* xref:configuration:assemble/archive.adoc[]
+ * xref:configuration:assemble/java-archive.adoc[]
* xref:configuration:assemble/jlink.adoc[]
* xref:configuration:assemble/jpackage.adoc[]
* xref:configuration:assemble/native-image.adoc[]
diff --git a/docs/modules/configuration/nav.adoc b/docs/modules/configuration/nav.adoc
index c3198710b..3193a4e0f 100644
--- a/docs/modules/configuration/nav.adoc
+++ b/docs/modules/configuration/nav.adoc
@@ -20,6 +20,7 @@
*** xref:announce/zulip.adoc[]
** xref:assemble/index.adoc[]
*** xref:assemble/archive.adoc[]
+*** xref:assemble/java-archive.adoc[]
*** xref:assemble/jlink.adoc[]
*** xref:assemble/jpackage.adoc[]
*** xref:assemble/native-image.adoc[]
diff --git a/docs/modules/configuration/pages/assemble/archive.adoc b/docs/modules/configuration/pages/assemble/archive.adoc
index eb54978ae..eb55fbdc9 100644
--- a/docs/modules/configuration/pages/assemble/archive.adoc
+++ b/docs/modules/configuration/pages/assemble/archive.adoc
@@ -1,6 +1,7 @@
= Archive
:assembler_id: archive
:archive: true
+:platform: true
Creates a binary distribution {assembler_id}.
@@ -166,11 +167,6 @@ Gradle::
----
include::partial$assemble/gradle/common-head.adoc[]
- // Additional properties used when evaluating templates.
- // Key will be capitalized and prefixed with `archive`, i.e, `archiveFoo`.
- // icon:dot-circle[] icon:file-alt[]
- extraProperties.put('foo', 'bar')
-
// Name of the archive.
// If left undefined, will use {{distributionName}}-{{projectVersion}}.
// icon:dot-circle[] icon:file-alt[]
diff --git a/docs/modules/configuration/pages/assemble/index.adoc b/docs/modules/configuration/pages/assemble/index.adoc
index e46053465..091314d96 100644
--- a/docs/modules/configuration/pages/assemble/index.adoc
+++ b/docs/modules/configuration/pages/assemble/index.adoc
@@ -116,6 +116,7 @@ with a `true` value inside xref:configuration:environment.adoc[] properties or a
* `skipAssembleResolvers`
* `skipArchiveResolver`
+* `skipJavaArchiveResolver`
* `skipJlinkResolver`
* `skipJpackageResolver`
* `skipNativeImageResolver`
diff --git a/docs/modules/configuration/pages/assemble/java-archive.adoc b/docs/modules/configuration/pages/assemble/java-archive.adoc
new file mode 100644
index 000000000..f3aa26024
--- /dev/null
+++ b/docs/modules/configuration/pages/assemble/java-archive.adoc
@@ -0,0 +1,441 @@
+= Java Archive
+:assembler_id: javaArchive
+:archive: true
+:java-assembler!:
+:platform!:
+
+Creates an archive for a xref:ROOT:distributions/java-binary.adoc[] distribution.
+
+include::partial$legend.adoc[]
+
+[tabs]
+====
+YAML::
++
+--
+[source,yaml]
+[subs="attributes,+macros"]
+----
+include::partial$assemble/yaml/common-head.adoc[]
+
+ # Name of the archive.
+ # If left undefined, will use {{distributionName}}-{{projectVersion}}.
+ # icon:dot-circle[] icon:file-alt[]
+ archiveName: 'app-{{projectVersion}}'
+
+ # Directory with file templates used to prepare the Jpackage assembler.
+ # Defaults to `src/jreleaser/assemblers/${distribution.name}/java-archive`.
+ # If specified, path must exist.
+ # icon:dot-circle[]
+ templateDirectory: path/to/java-archive/templates
+
+ # icon:dot-circle[]
+ executable:
+ # Name of the executable launcher.
+ # If left undefined, will use ${distribution.name}.
+ # icon:dot-circle[]
+ name: app
+
+ # Executable extension on Linux/MacOS.
+ # If left undefined, value will be left empty.
+ # icon:dot-circle[]
+ unixExtension: sh
+
+ # Executable extension on Windows.
+ # If left undefined, will use `bat`.
+ # icon:dot-circle[]
+ windowsExtension: cmd
+
+ # Set of archive formats to use.
+ # Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TBZ2`, `TGZ`, `TXZ`].
+ # icon:dot-circle[]
+ formats:
+ - ZIP
+ - TGZ
+
+include::partial$assemble/yaml/common-java.adoc[]
+----
+--
+TOML::
++
+--
+[source,toml]
+[subs="attributes,+macros"]
+----
+include::partial$assemble/toml/common-head.adoc[]
+
+ # Name of the archive.
+ # If left undefined, will use {{distributionName}}-{{projectVersion}}.
+ # icon:dot-circle[] icon:file-alt[]
+ archiveName = "app-{{projectVersion}}"
+
+ # Directory with file templates used to prepare the JavaArchive assembler.
+ # Defaults to `src/jreleaser/assemblers/${distribution.name}/java-archive`.
+ # If specified, path must exist.
+ # icon:dot-circle[]
+ templateDirectory = "path/to/java-archive/templates"
+
+ # icon:dot-circle[]
+ [assemble.{assembler_id}.app.executable]
+ # Name of the executable launcher.
+ # If left undefined, will use ${distribution.name}.
+ # icon:dot-circle[]
+ name = "app"
+
+ # Executable extension on Linux/MacOS.
+ # If left undefined, value will be left empty.
+ # icon:dot-circle[]
+ unixExtension = "sh"
+
+ # Executable extension on Windows.
+ # If left undefined, will use `bat`.
+ # icon:dot-circle[]
+ windowsExtension = "cmd"
+
+ # Set of archive formats to use.
+ # Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TBZ2`, `TGZ`, `TXZ`].
+ # icon:dot-circle[]
+ formats = [ "ZIP", "TGZ"]
+
+include::partial$assemble/toml/common-java.adoc[]
+----
+--
+JSON::
++
+--
+[source,json]
+[subs="attributes,+macros"]
+----
+include::partial$assemble/json/common-head.adoc[]
+
+ // Name of the archive.
+ // If left undefined, will use {{distributionName}}-{{projectVersion}}.
+ // icon:dot-circle[] icon:file-alt[]
+ "archiveName": "app-{{projectVersion}}",
+
+ // Directory with file templates used to prepare the JavaArchive assembler.
+ // Defaults to `src/jreleaser/assemblers/${distribution.name}/java-archive`.
+ // If specified, path must exist.
+ // icon:dot-circle[]
+ "templateDirectory": "path/to/java-archive/templates",
+
+ // icon:dot-circle[]
+ "executable": {
+ // Name of the executable launcher.
+ // If left undefined, will use ${distribution.name}.
+ // icon:dot-circle[]
+ "name": "app",
+
+ // Executable extension on Linux/MacOS.
+ // If left undefined, value will be left empty.
+ // icon:dot-circle[]
+ "unixExtension": "sh",
+
+ // Executable extension on Windows.
+ // If left undefined, will use `bat`.
+ // icon:dot-circle[]
+ "windowsExtension": "cmd"
+ },
+
+ // Set of archive formats to use.
+ // Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TBZ2`, `TGZ`, `TXZ`].
+ // icon:dot-circle[]
+ "formats": [
+ "ZIP",
+ "TGZ"
+ ],
+
+include::partial$assemble/json/common-java.adoc[]
+include::partial$assemble/json/common-footer.adoc[]
+----
+--
+Maven::
++
+--
+[source,xml]
+[subs="attributes,verbatim,+macros"]
+----
+include::partial$assemble/maven/common-head.adoc[]
+
+
+ app-{{projectVersion}}
+
+
+ path/to/brew/templates
+
+
+
+
+ app
+
+
+ sh
+
+
+ cmd
+
+
+
+
+ ZIP
+ TGZ
+
+
+include::partial$assemble/maven/common-java.adoc[]
+include::partial$assemble/maven/common-footer.adoc[]
+----
+--
+Gradle::
++
+--
+[source,groovy]
+[subs="attributes,+macros"]
+----
+include::partial$assemble/gradle/common-head.adoc[]
+
+ // Name of the archive.
+ // If left undefined, will use {{distributionName}}-{{projectVersion}}.
+ // icon:dot-circle[] icon:file-alt[]
+ archiveName = 'app-{{projectVersion}}'
+
+ // Directory with file templates used to prepare the JavaArchive assembler.
+ // Defaults to `src/jreleaser/assemblers/${distribution.name}/java-archive`.
+ // If specified, path must exist.
+ // icon:dot-circle[]
+ templateDirectory = 'path/to/java-archive/templates'
+
+ // icon:dot-circle[]
+ executable {
+ // Name of the executable launcher.
+ // If left undefined, will use ${distribution.name}.
+ // icon:dot-circle[]
+ name = 'app'
+
+ // Executable extension on Linux/MacOS.
+ // If left undefined, value will be left empty.
+ // icon:dot-circle[]
+ unixExtension = 'sh'
+
+ // Executable extension on Windows.
+ // If left undefined, will use `bat`.
+ // icon:dot-circle[]
+ windowsExtension = 'cmd'
+ }
+
+ // Set of archive formats to use.
+ // Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TBZ2`, `TGZ`, `TXZ`].
+ // icon:dot-circle[]
+ formats = [
+ 'ZIP',
+ 'TGZ'
+ ]
+
+include::partial$assemble/gradle/common-java.adoc[]
+include::partial$assemble/gradle/common-footer.adoc[]
+----
+--
+====
+
+== Example
+
+Given the following file structure
+
+[source]
+----
+.
+├── BUILD
+├── LICENSE
+├── README
+└── target
+ └── app-1.0.0.jar
+----
+
+And this assembly configuration
+
+[tabs]
+====
+YAML::
++
+--
+[source,yaml]
+[subs="+macros"]
+----
+project:
+ version: 1.0.0
+
+assemble:
+ javaArchive:
+ app:
+ active: ALWAYS
+ fileSets:
+ - input: '.'
+ includes:
+ - 'LICENSE'
+ - 'README'
+ mainJar:
+ path: target/{{distributionName}}-{{projectVersion}}.jar
+ java:
+ mainClass: com.acme.Main
+----
+--
+TOML::
++
+--
+[source,toml]
+[subs="+macros"]
+----
+[project]
+ version = "1.0.0"
+
+[assemble.javaArchive.app]
+ active = "ALWAYS"
+ pass:[[[assemble.archive.app.fileSets]]]
+ input = "."
+ includes = ["LICENSE", "README"]
+ pass:[[[assemble.archive.app.mainJar]]]
+ path = "target/{{distributionName}}-{{projectVersion}}.jar"
+ pass:[[[assemble.archive.app.java]]]
+ mainClass = "com.acme.Main"
+----
+--
+JSON::
++
+--
+[source,json]
+[subs="+macros"]
+----
+{
+ "project": {
+ "version": "1.0.0"
+ },
+ "assemble": {
+ "javaArchive": {
+ "app": {
+ "active": "ALWAYS",
+ "fileSets": [
+ {
+ "input": ".",
+ "includes": ["LICENSE", "README"]
+ }
+ ],
+ "mainJar": [
+ {
+ "path": "target/{{distributionName}}-{{projectVersion}}.jar"
+ }
+ ],
+ "java": {
+ "mainClass": "com.acme.Main"
+ }
+ }
+ }
+ }
+}
+----
+--
+Maven::
++
+--
+[source,xml]
+[subs="verbatim,+macros"]
+----
+
+
+ 1.0.0
+
+
+
+
+ ALWAYS
+
+
+ .
+
+ LICENSE
+ README
+
+
+
+
+ target/{{distributionName}}-{{projectVersion}}.jar
+
+
+ com.acme.Main
+
+
+
+
+
+----
+--
+Gradle::
++
+--
+[source,groovy]
+[subs="+macros"]
+----
+jreleaser {
+ project {
+ version = '1.0.0'
+ }
+ assemble {
+ javaArchive {
+ app {
+ active = 'ALWAYS'
+ fileSet {
+ input = '.'
+ includes = ['LICENSE', 'README']
+ }
+ mainJar {
+ path = 'target/{{distributionName}}-{{projectVersion}}.jar'
+ }
+ java {
+ mainClass('com.acme.Main')
+ }
+ }
+ }
+ }
+}
+----
+--
+====
+
+Results in an assembled Zip archive named `app-1.0.0.zip` with the following entries
+
+[source]
+----
+.
+├── LICENSE
+├── README
+├── bin
+│ ├── app
+│ └── app.bat
+└── lib
+ └── app-1.0.0.jar
+----
diff --git a/docs/modules/configuration/pages/assemble/jlink.adoc b/docs/modules/configuration/pages/assemble/jlink.adoc
index 34bd683b2..babe33f8e 100644
--- a/docs/modules/configuration/pages/assemble/jlink.adoc
+++ b/docs/modules/configuration/pages/assemble/jlink.adoc
@@ -1,6 +1,8 @@
= Jlink
-:assembler_id: jlink
+:assembler_id: jlink
:archive!:
+:java-assembler: true
+:platform: true
Creates a Java Runtime image using link:https://docs.oracle.com/en/java/javase/11/tools/jlink.html[{assembler_id}].
diff --git a/docs/modules/configuration/pages/assemble/jpackage.adoc b/docs/modules/configuration/pages/assemble/jpackage.adoc
index 42b8c6dac..1eba7a8a7 100644
--- a/docs/modules/configuration/pages/assemble/jpackage.adoc
+++ b/docs/modules/configuration/pages/assemble/jpackage.adoc
@@ -1,5 +1,7 @@
= Jpackage
-:assembler_id: jpackage
+:assembler_id: jpackage
+:java-assembler: true
+:platform: true
Creates platform installers with the link:https://docs.oracle.com/en/java/javase/17/jpackage/packaging-overview.html[jpackage]
tool.
diff --git a/docs/modules/configuration/pages/assemble/native-image.adoc b/docs/modules/configuration/pages/assemble/native-image.adoc
index 6efb53e5a..9acb0dab1 100644
--- a/docs/modules/configuration/pages/assemble/native-image.adoc
+++ b/docs/modules/configuration/pages/assemble/native-image.adoc
@@ -1,5 +1,7 @@
= Native Image
-:assembler_id: nativeImage
+:assembler_id: nativeImage
+:java-assembler: true
+:platform: true
Creates a Native Image binary using link:https://www.graalvm.org/reference-manual/native-image/[GraalVM Native Image].
diff --git a/docs/modules/configuration/partials/assemble/gradle/common-head.adoc b/docs/modules/configuration/partials/assemble/gradle/common-head.adoc
index 2719f7143..4244169d6 100644
--- a/docs/modules/configuration/partials/assemble/gradle/common-head.adoc
+++ b/docs/modules/configuration/partials/assemble/gradle/common-head.adoc
@@ -28,6 +28,7 @@ jreleaser {
// Key will be capitalized and prefixed with `{assembler_id}`, i.e, `{assembler_id}Foo`.
// icon:dot-circle[] icon:file-alt[]
extraProperties.put('foo', 'bar')
+ifdef::platform[]
// icon:dot-circle[]
platform {
@@ -42,4 +43,5 @@ jreleaser {
x86_64: 'amd64',
linux_musl: 'alpine'
]
- }
\ No newline at end of file
+ }
+endif::platform[]
\ No newline at end of file
diff --git a/docs/modules/configuration/partials/assemble/gradle/common-java.adoc b/docs/modules/configuration/partials/assemble/gradle/common-java.adoc
index 8bb5281cd..6b3d8b547 100644
--- a/docs/modules/configuration/partials/assemble/gradle/common-java.adoc
+++ b/docs/modules/configuration/partials/assemble/gradle/common-java.adoc
@@ -15,6 +15,22 @@
// icon:dot-circle[]
java {
+ // Name of main module (if any).
+ // Define only if the application is modular.
+ // icon:dot-circle[]
+ mainModule = 'com.acme.demo'
+
+ // The application's entry point.
+ // If left undefined, will use ${project.java.mainClass}.
+ // icon:dot-circle[]
+ mainClass = 'com.acme.Main'
+ifndef::java-assembler[]
+
+ // Options to pass to the Java runtime
+ // icon:dot-circle[]
+ options = ['-Xmx2048m']
+endif::java-assembler[]
+ifdef::java-assembler[]
// Maven coordinates = groupId.
// If left undefined, will use ${project.java.groupId}.
// icon:dot-circle[]
@@ -30,16 +46,6 @@
// icon:dot-circle[]
version = '8'
- // Name of main module (if any).
- // Define only if the application is modular.
- // icon:dot-circle[]
- mainModule = 'com.acme.demo'
-
- // The application's entry point.
- // If left undefined, will use ${project.java.mainClass}.
- // icon:dot-circle[]
- mainClass = 'com.acme.Main'
-
// Identifies the project as being member of a multi-project build.
// If left undefined, will use ${project.java.multiProject}.
// icon:dot-circle[]
@@ -49,6 +55,7 @@
// Key will be capitalized and prefixed with `java`, i.e, `javaFoo`.
// icon:dot-circle[]
extraProperties.put('foo', 'bar')
+endif::java-assembler[]
}
// Defines a list of additional files as globs.
diff --git a/docs/modules/configuration/partials/assemble/json/common-head.adoc b/docs/modules/configuration/partials/assemble/json/common-head.adoc
index d1116cc61..a86c9dc74 100644
--- a/docs/modules/configuration/partials/assemble/json/common-head.adoc
+++ b/docs/modules/configuration/partials/assemble/json/common-head.adoc
@@ -30,7 +30,9 @@
// Key will be capitalized and prefixed with `{assembler_id}`, i.e, `{assembler_id}Foo`.
"foo": "bar"
},
+ifdef::platform[]
+ // icon:dot-circle[]
platform: {
// Key value pairs.
// Keys match a full platform or an os.name, os.arch.
@@ -42,4 +44,5 @@
"x86_64": "amd64",
"linux_musl": "alpine"
}
- },
\ No newline at end of file
+ },
+endif::platform[]
\ No newline at end of file
diff --git a/docs/modules/configuration/partials/assemble/json/common-java.adoc b/docs/modules/configuration/partials/assemble/json/common-java.adoc
index 95ef2a9fc..8c14c4428 100644
--- a/docs/modules/configuration/partials/assemble/json/common-java.adoc
+++ b/docs/modules/configuration/partials/assemble/json/common-java.adoc
@@ -17,6 +17,22 @@
// icon:dot-circle[]
"java": {
+ // Name of main module (if any).
+ // Define only if the application is modular.
+ // icon:dot-circle[]
+ "mainModule": "com.acme.demo",
+
+ // The application's entry point.
+ // If left undefined, will use ${project.java.mainClass}.
+ // icon:dot-circle[]
+ "mainClass": "com.acme.Main",
+ifndef::java-assembler[]
+
+ // Options to pass to the Java runtime
+ // icon:dot-circle[]
+ "options": ["-Xmx2048m"],
+endif::java-assembler[]
+ifdef::java-assembler[]
// Maven coordinates: groupId.
// If left undefined, will use ${project.java.groupId}.
// icon:dot-circle[]
@@ -32,16 +48,6 @@
// icon:dot-circle[]
"version": "8",
- // Name of main module (if any).
- // Define only if the application is modular.
- // icon:dot-circle[]
- "mainModule": "com.acme.demo",
-
- // The application's entry point.
- // If left undefined, will use ${project.java.mainClass}.
- // icon:dot-circle[]
- "mainClass": "com.acme.Main",
-
// Identifies the project as being member of a multi-project build.
// If left undefined, will use ${project.java.multiProject}.
// icon:dot-circle[]
@@ -53,6 +59,7 @@
// Key will be capitalized and prefixed with `java`, i.e, `javaFoo`.
"foo": "bar"
}
+endif::java-assembler[]
},
// Defines a list of additional files as globs.
diff --git a/docs/modules/configuration/partials/assemble/maven/common-head.adoc b/docs/modules/configuration/partials/assemble/maven/common-head.adoc
index 730803433..3d7615fca 100644
--- a/docs/modules/configuration/partials/assemble/maven/common-head.adoc
+++ b/docs/modules/configuration/partials/assemble/maven/common-head.adoc
@@ -45,6 +45,7 @@
-->
bar
+ifdef::platform[]
+
+ com.acme.demo
+
+
+ com.acme.Main
+ifndef::java-assembler[]
+
+
+ -Xmx2048m
+endif::java-assembler[]
+ifdef::java-assembler[]
8
-
- com.acme.demo
-
-
- com.acme.Main
-
bar
+endif::java-assembler[]