### Install JReleaser via Setup Script
Source: https://jreleaser.org/guide/latest/install.html
Use this script for a quick installation on Linux and macOS. It handles downloading and setting up JReleaser.
```bash
curl https://jreleaser.org/setup.sh -sSfL | sh
```
--------------------------------
### XML Configuration Example
Source: https://jreleaser.org/guide/latest/reference/name-templates.html
Example of JReleaser configuration in XML format, showing how to define checksums and distributions.
```xml
MD5
SHA-256
path/to/{{distributionName}}-{{projectVersion}}.zip
true
path/to/{{distributionName}}-{{projectVersion}}-mac.zip
osx-aarch_64
```
--------------------------------
### JSON Configuration Example
Source: https://jreleaser.org/guide/latest/reference/name-templates.html
Example of JReleaser configuration in JSON format, demonstrating the structure for checksums and distributions.
```json
{
"checksums": {
"algorithms": [
"MD5",
"SHA-256"
]
},
"distributions": {
"app": {
"artifacts": [
{
"path": "path/to/{{distributionName}}-{{projectVersion}}.zip",
"extraProperties":
{
"main": true
}
},
{
"path": "path/to/{{distributionName}}-{{projectVersion}}-mac.zip",
"platform": "osx-aarch_64"
}
],
}
}
}
```
--------------------------------
### Add Scoop Bucket and Install App
Source: https://jreleaser.org/guide/latest/reference/packagers/scoop.html
These commands demonstrate how users can add your Scoop bucket to their local configuration and then install your application.
```bash
scoop bucket add duke https://github.com/duke/scoop-duke.git
```
```bash
scoop install app
```
--------------------------------
### Install JReleaser with Snap
Source: https://jreleaser.org/guide/latest/install.html
Install JReleaser using Snap. This provides a sandboxed environment for the application.
```bash
snap install jreleaser
```
--------------------------------
### Example Commit Log
Source: https://jreleaser.org/guide/latest/reference/release/changelog.html
This is an example log of project commits, used to demonstrate changelog generation.
```text
* bda315f (HEAD -> main, upstream/main) docs: Add missing ". (#1048)
* 3adf1b5 fix: Do not force .java suffix for Quarkus based templates (#1039)
* 013f328 feat: Startup scripts now use User-Agent header for downloads (#1037)
* 47e2a81 fix: This fixes extraneous jbang.cmd output (#1041)
* fe08627 refactor: Simplified `jbang.cmd` (#1038)
* ea65d99 fix: add hint to user they can get updated catalog using --fresh (#1040)
* 8ac258c fix: No longer pass Accept header (#1036)
* 95a715e [patch] fix linux based java download
* 275d31a fix: archive type for foojay. Fixes #1035
* d42951d [patch]
* 98866f1 fix: Add itest for issue #1019 (#1033)
* 20514c7 fix: Now really fixed updating on Windows (#1031)
* 9ed4116 [minor]
* fb45502 chore: use jreleaser 0.7
* 7419590 fix: edit now honors JBANG_EDITOR again
* 3955647 fix: Not checking for new version on first run anymore (#1023)
* 5e16e22 fix: jbang edit suggests incorrect command when template renames out… (#1020)
* 3ac5561 fix: --deps now gets special javafx treatments as //DEPS does (#1017)
* 52b2377 fix: Fixed link to "Usage on Windows" (#1026)
* 8d5ea6a fix: Fixed download URL in `jbang` script (#1021)
* b750ebb fix: kotlin edit now link to source rather than cache location (#1015)
* 6f87c70 chore: eliminate warnings from code base (#1011)
* f842666 docs: Update spotless pre-commit hook url (#1009)
* d297667 [patch] fix java 17 downloads
* f6a32db fix: use termurin for java 17
* 43b2c72 chore: remove j'bang from choco name, its just JBang
* da0c971 fix: proper nuget
* 30cf637 (tag: v0.80.1) [patch]
```
--------------------------------
### JReleaser Configuration Example
Source: https://jreleaser.org/guide/latest/examples/jreleaser.html
This is a comprehensive example of a JReleaser configuration file used for creating both release and snapshot releases.
```yaml
# Define properties we'll use later in this file
environment:
properties:
jdkPathPrefix: 'plugins/jreleaser/build/jdks'
jdkFilePrefix: 'zulu25.30.17-ca-jdk25.0.1'
graalFilePrefix: 'graalvm-jdk-25.0.1+8.1'
nativeImageDir: out/jreleaser/assemble/jreleaser-native/native-image
jpackageDir: out/jreleaser/assemble/jreleaser-installer/jpackage
javaArchiveDir: out/jreleaser/assemble/jreleaser/java-archive
# General information about this project
project:
name: jreleaser
description: Release projects quickly and easily with JReleaser
longDescription: |
JReleaser is a release automation tool. Its goal is to simplify creating releases and
publishing artifacts to multiple package managers while providing customizable options.
JReleaser takes inputs from popular builds tools (Ant, Maven, Gradle) such as JAR files,
binary distributions (.zip, .tar), jlink images, or any other file that you’d like to
publish as a Git release on popular Git services such as GitHub, GitLab, or Gitea.
Distribution files may additionally be published to be consumed by popular package managers
such as Homebrew, Chocolatey, Snapcraft, or get ready to be launched via JBang. Releases
may be announced in a variety of channels such as Twitter, Zulip, SDKMAN!, and more.
links:
homepage: https://jreleaser.org
faq: https://{{repoHost}}/{{repoOwner}}/{{repoName}}/discussions
donation: https://opencollective.com/jreleaser
documentation: https://jreleaser.org/guide/latest
authors:
- Andres Almiray
license: Apache-2.0
inceptionYear: 2020
stereotype: CLI
screenshots:
- url: https://jreleaser.org/images/app-full-release-command.png
caption: JReleaser in action
icons:
- url: https://raw.githubusercontent.com/jreleaser/jreleaser/main/src/media/icon_256x256.png
width: 256
height: 256
languages:
java:
groupId: org.jreleaser
version: 8
multiProject: true
mainClass: org.jreleaser.cli.Main
tags:
- 'jreleaser'
- 'release'
- 'tool'
- 'java'
- 'git'
platform:
replacements:
# Replace matching platforms in filenames of assembled artifacts
aarch_64: aarch64
release:
github:
overwrite: true
sign: true
discussionCategoryName: Announcements
issues:
enabled: true
changelog:
formatted: ALWAYS
preset: conventional-commits
contributors:
format: '- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}'
contentTemplate: 'src/jreleaser/changelog.tpl'
extraProperties:
categorizeScopes: true
labelers:
- label: 'i18n'
title: 'regex:^(?:i18n(?:\(.*\))?!?):\s.*'
order: 120
- label: 'dependencies'
title: 'regex:^(?:deps(?:\(.*\))?!?):\s.*'
order: 130
- label: 'allcontributors1'
title: 'regex:^docs: update .all-contributorsrc.*'
order: -1
- label: 'allcontributors2'
title: 'regex:^docs: update Contributors.md.*'
order: -2
categories:
- title: '🌐 Translation'
key: 'i18n'
order: 70
labels:
- 'i18n'
- title: '⚙️ Dependencies'
key: 'dependencies'
order: 80
labels:
- 'dependencies'
- title: 'allcontributors'
order: 59
labels:
- 'allcontributors1'
- 'allcontributors2'
hide:
categories:
- 'merge'
- 'allcontributors'
contributors:
- 'GitHub'
- 'allcontributors'
- 'dependabot'
replacers:
- search: 'i18n: '
- search: 'deps: '
# File signing is always active
signing:
active: ALWAYS
armored: true
catalog:
# Generate SBOMs for all distributions and files
sbom:
syft:
active: ALWAYS
pack:
enabled: true
# Configure SWID tag with defaults
swid:
swid-tag:
active: ALWAYS
# Deploy JARs and POMs to Maven Central
deploy:
maven:
mavenCentral:
release-deploy:
active: RELEASE
url: https://central.sonatype.com/api/v1/publisher
maxRetries: 150
retryDelay: 30
stagingRepositories:
- build/repos/local/release
```
--------------------------------
### YAML Configuration Example
Source: https://jreleaser.org/guide/latest/reference/name-templates.html
Example of JReleaser configuration in YAML format, defining checksum algorithms and distributions with artifacts.
```yaml
checksum:
algorithms:
- MD5
- SHA-256
distributions:
app:
artifacts:
- path: path/to/{{distributionName}}-{{projectVersion}}.zip
extraProperties:
main: true
- path: path/to/{{distributionName}}-{{projectVersion}}-mac.zip
platform: osx-aarch_64
```
--------------------------------
### Groovy Configuration Example
Source: https://jreleaser.org/guide/latest/reference/name-templates.html
Example of JReleaser configuration in Groovy DSL format, illustrating checksum and distribution definitions.
```groovy
jreleaser {
checksum {
algorithm('MD5')
algorithm('SHA-256')
}
distributions {
app {
artifact {
path = "path/to/{{distributionName}}-{{projectVersion}}.zip"
extraProperties.put("main", true)
}
artifact {
path = "path/to/{{distributionName}}-{{projectVersion}}-mac.zip"
platform = 'osx-aarch_64'
}
}
}
}
```
--------------------------------
### TOML Configuration Example
Source: https://jreleaser.org/guide/latest/reference/name-templates.html
Example of JReleaser configuration in TOML format, mirroring the YAML structure for checksums and distributions.
```toml
[checksum]
algorithms = ["MD5", "SHA-256"]
[[distributions.app.artifact]]
path: "path/to/{{distributionName}}-{{projectVersion}}.zip"
extraProperties.main = true
[[distributions.app.artifact]]
path = "path/to/{{distributionName}}-{{projectVersion}}-mac.zip"
platform = "osx-aarch_64"
```
--------------------------------
### Snapcraft.yaml Configuration Example
Source: https://jreleaser.org/guide/latest/reference/packagers/snap.html
This is an example of a snapcraft.yaml file generated by JReleaser for an application named 'app'. It specifies application details, confinement, base OS, and defines the application's command and environment variables.
```yaml
name: app
version: 1.2.3
summary: Sample app
description: Sample app
grade: stable
confinement: strict
base: core20
type: app
apps:
app:
command: $SNAP/bin/app
environment:
JAVA_HOME: "$SNAP/usr/lib/jvm/java/jre/"
PATH: "$SNAP/bin:$PATH:$SNAP/usr/lib/jvm/java/jre/bin"
parts:
app:
plugin: dump
source: https://github.com/duke/app/releases/download/v1.2.3/app-1.2.3.tar.gz
source-checksum: sha256/8e74020ca5e7d01d25c34cf1bd53adcf78c77adf7b53530ae5e0baeb841cb43e
stage-packages:
- openjdk-8-jre
- ca-certificates
- ca-certificates-java
organize:
'usr/lib/jvm/java-8-openjdk*': usr/lib/jvm/java
prime:
- -usr/lib/jvm/java/lib/security/cacerts
- -usr/lib/jvm/java/jre/lib/security/cacerts
```
--------------------------------
### Generated Dockerfile Example
Source: https://jreleaser.org/guide/latest/reference/packagers/docker.html
This is an example of a Dockerfile generated by JReleaser for a distribution named 'app' with version '1.2.3'. It includes labels, copies assembly files, and sets the entrypoint.
```dockerfile
FROM azul/zulu-openjdk-alpine:8-jre
LABEL "org.opencontainers.image.title"="app"
LABEL "org.opencontainers.image.description"="Awesome App"
LABEL "org.opencontainers.image.url"="https://acme.com/app"
LABEL "org.opencontainers.image.licenses"="Apache-2.0"
LABEL "org.opencontainers.image.version"="1.2.3"
LABEL "org.opencontainers.image.revision"="de0266d314b91dd201765616e207d0a8706d0b99"
LABEL "org.opencontainers.image.source"="https://github.com/acme/app"
COPY assembly/* /
RUN unzip app-1.2.3.zip && \
rm app-1.2.3.zip && \
chmod +x app-1.2.3/bin/app
ENV PATH="${PATH}:/app-1.2.3/bin"
ENTRYPOINT ["/app-1.2.3/bin/app"]
```
--------------------------------
### JLink Configuration Example
Source: https://jreleaser.org/guide/latest/reference/assemble/jlink.html
Example of a JLink configuration block within a build script. This snippet demonstrates how to define modules and other JLink options.
```groovy
jlink {
enabled = true
moduleNames = [
'java.base',
'java.logging',
'jdk.jlink',
'org.jreleaser.model'
]
stripDebug = true
compress = '2'
noHeaderFiles = true
noManPages = true
order = 'compact'
outputDirectory = file("${buildDir}/jlink")
}
```
--------------------------------
### Example JReleaser Configuration File
Source: https://jreleaser.org/guide/latest/quick-start/ant.html
This is an example of a generated 'jreleaser.yml' file. Edit this file to match your project's specific details, such as name, version, authors, license, and artifact paths.
```yaml
project:
name: app
version: 1.0.0-SNAPSHOT
description: Awesome App
longDescription: Awesome App
authors:
- Duke
license: Apache-2
links:
homepage: https://acme.com/app
languages:
java:
groupId: com.acme
version: 8
inceptionYear: 2021
release:
github:
owner: duke
distributions:
app:
artifacts:
- path: path/to/{{distributionName}}-{{projectVersion}}.zip
```
--------------------------------
### Setup All JDKs
Source: https://jreleaser.org/guide/latest/tools/jdks-gradle.html
Downloads, verifies, unpacks, and sets up all configured JDKs. This is a comprehensive task to prepare your environment with the necessary JDKs.
```bash
$ gm setuJdks
> Task :downloadJdkZulu11Linux
Download https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-linux_x64.zip
> Task :downloadJdkZulu11Osx
Download https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-macosx_x64.zip
> Task :downloadJdkZulu11Windows
Download https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-win_x64.zip
> Task :downloadJdks
> Task :verifyJdkZulu11Linux
> Task :unpackJdkZulu11Linux
> Task :verifyJdkZulu11Osx
> Task :unpackJdkZulu11Osx
> Task :verifyJdkZulu11Windows
> Task :unpackJdkZulu11Windows
> Task :unpackJdks
> Task :verifyJdks
> Task :setupJdks
> Task :copyJdksToCache
Copied!
```
--------------------------------
### Homebrew Formula Example
Source: https://jreleaser.org/guide/latest/reference/packagers/homebrew.html
This is an example of a Homebrew formula generated by JReleaser for a sample application. It includes dependencies, installation instructions, and a test case.
```ruby
class App < Formula
desc "Sample app"
homepage "https://acme.com/app"
version "1.2.3"
url "https://github.com/duke/app/releases/download/v1.2.3/app-1.2.3.zip"
sha256 "812121a64bbd3f49286f7b0be3c9209068f71fcf9541f313708979602e8de466"
license "Apache-2.0"
depends_on "openjdk@8"
def install
libexec.install Dir["*"]
bin.install_symlink "#{libexec}/bin/app"
end
test do
output = shell_output("#{bin}/app --version")
assert_match "1.2.3", output
end
end
```
--------------------------------
### MacPorts Portfile Example
Source: https://jreleaser.org/guide/latest/reference/packagers/macports.html
An example of a generated Portfile for a Java application packaged with JReleaser for MacPorts. This file defines package metadata, build, and installation steps.
```tcl
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup java 1.0
name app
version 1.2.3
revision 0
categories devel java
license Apache-2.0
maintainers @duke
platforms darwin
supported_archs noarch
description Awesome App
long_description Awesome App
homepage https://acme.com/app
master_sites https://github.com/duke/app/releases/download/v1.0.0/
use_zip yes
checksums rmd160 f7e88b1c323b5c1772ebce05837a7cfd4ceda09d \
sha256 53e89097573fb807adcf410169f117532ae17a4cd72066f9e40420eaf0d13147 \
size 6481
java.version 1.8.+
use_configure no
build {}
destroot {
set target ${destroot}${prefix}/share/java/${name}
# Create the target java directory
xinstall -m 755 -d ${target}
# Copy over the needed elements of our directory tree
foreach d { bin lib } {
copy ${worksrcpath}/${d} ${target}
}
# Remove extraneous bat files
foreach f [glob -directory ${target}/bin *.bat] {
delete ${f}
}
ln -s ../share/java/${name}/bin/app ${destroot}${prefix}/bin/app
}
livecheck.type none
tclCopied!
```
--------------------------------
### Example RPM Spec File
Source: https://jreleaser.org/guide/latest/reference/packagers/spec.html
This is an example of a spec file generated by JReleaser for an application named 'app'. It defines package metadata, installation scripts, and file lists.
```spec
Name: app
Version: 1.2.3
Release: 1%{?dist}
Summary: Sample App
License: Apache-2.0
URL: https://acme.com/app
Source0: https://github.com/duke/app/releases/download/v1.2.3/app-1.2.3.tar.gz
BuildArch: noarch
Requires: java
%description
Sample app
%prep
%setup -q
%install
mkdir -p %{buildroot}%{_bindir}
%define _appdir %{buildroot}%{_datadir}/%{name}
mkdir -p %{_appdir}/bin
cat > %{buildroot}%{_bindir}/app <<-EOF
#!/bin/sh
%{_datadir}/%{name}/bin/app "$@"
EOF
chmod 0755 %{buildroot}%{_bindir}/app
mkdir -p %{_appdir}/lib
install -p -m 755 bin/app %{_appdir}/bin/app
install -p -m 644 lib/app-%{version}.jar %{_appdir}/lib/app-%{version}.jar
%files
%{_bindir}/%{name}
%{_datadir}/%{name}/bin/app
%{_datadir}/%{name}/lib/app-%{version}.jar
tclCopied!
```
--------------------------------
### Project Version Example
Source: https://jreleaser.org/guide/latest/reference/name-templates.html
Illustrates how project version templates resolve with a snapshot label.
```text
Key | Version
---|---
projectVersion | 1.2.3-TAG
projectVersionWithUnderscores | 1_2_3_TAG
projectVersionWithDashes | 1-2-3-TAG
projectEffectiveVersionWithUnderscores | 1_2_3_EarlyAccess
projectEffectiveVersionWithDashes | 1-2-3-EarlyAccess
projectVersionNumberWithUnderscores | 1_2_3
projectVersionNumberWithDashes | 1-2-3
```
--------------------------------
### Docker Configuration Example
Source: https://jreleaser.org/guide/latest/reference/packagers/docker.html
Configure Docker image settings, including registry authentication and repository name. Use environment variables for sensitive information like passwords.
```groovy
docker {
imageName = 'jreleaser/my-app'
tag = 'latest'
args = [
'--label', 'maintainer=JReleaser ',
'--label', 'org.opencontainers.image.source=https://github.com/jreleaser/jreleaser'
]
registry {
// Password for login into the registry
// __ __
password = '__USE_ENVIRONMENT_VARIABLE__'
// The name of the repository
// Defaults to the same owner as the release repository.
// __
repositoryName = 'duke'
}
}
```
--------------------------------
### Mustache Comment Example
Source: https://jreleaser.org/guide/latest/concepts/templates/mustache.html
Comments in Mustache are ignored during rendering. They start with a bang (`{{! comment }}`) and can span multiple lines.
```mustache
Today{{! ignore me }}.
```
--------------------------------
### Jib Configuration with Jlink Distribution
Source: https://jreleaser.org/guide/latest/reference/packagers/jib.html
Example of a Jib configuration within a JReleaser `build.yml` file, demonstrating how to integrate with a Jlink-assembled distribution. This setup includes defining target JDKs for various platforms and configuring Jib packager settings.
```yaml
environment:
properties:
jdkPathPrefix: 'target/jdks'
jdkFilePrefix: 'zulu17.32.13-ca-jdk17.0.2'
project:
name: helloworld
description: HelloWorld in Java
longDescription: HelloWorld in Java
links:
homepage: https://github.com/jreleaser/helloworld-java-jlink
authors:
- Andres Almiray
license: APACHE-2.0
inceptionYear: 2023
stereotype: CLI
java:
version: 11
groupId: org.jreleaser.examples
artifactId: helloworld
mainClass: org.jreleaser.examples.HelloWorld
release:
github:
overwrite: true
changelog:
formatted: ALWAYS
preset: conventional-commits
contributors:
format: '- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}'
assemble:
jlink:
helloworld:
active: ALWAYS
imageName: '{{distributionName}}-{{projectVersion}}'
targetJdks:
- path: '{{jdkPathPrefix}}/zulu17OsxIntel/{{jdkFilePrefix}}-macosx_x64/zulu-17.jdk/Contents/Home'
platform: 'osx-x86_64'
- path: '{{jdkPathPrefix}}/zulu17OsxArm/{{jdkFilePrefix}}-macosx_aarch64/zulu-17.jdk/Contents/Home'
platform: 'osx-aarch_64'
- path: '{{jdkPathPrefix}}/zulu17LinuxIntel/{{jdkFilePrefix}}-linux_x64'
platform: 'linux-x86_64'
- path: '{{jdkPathPrefix}}/zulu17LinuxMuslIntel/{{jdkFilePrefix}}-linux_musl_x64'
platform: 'linux_musl-x86_64'
- path: '{{jdkPathPrefix}}/zulu17LinuxArm/{{jdkFilePrefix}}-linux_aarch64'
platform: 'linux-aarch_64'
- path: '{{jdkPathPrefix}}/zulu17WindowsIntel/{{jdkFilePrefix}}-win_x64'
platform: 'windows-x86_64'
- path: '{{jdkPathPrefix}}/zulu17WindowsArm/{{jdkFilePrefix}}-win_aarch64'
platform: 'windows-aarch_64'
mainJar:
path: 'target/{{distributionName}}-{{projectVersion}}.jar'
packagers:
jib:
active: ALWAYS
registries:
- name: github
server: ghcr.io
distributions:
# name must match!
helloworld:
jib:
# configure 2 specs
specs:
slim:
imageNames:
- 'duke/{{distributionName}}-{{jibSpecName}}:{{tagName}}'
- 'duke/{{distributionName}}-{{jibSpecName}}:latest'
matchers:
# match by platform
platform: 'linux-x86_64'
alpine:
imageNames:
- 'duke/{{distributionName}}-{{jibSpecName}}:{{tagName}}'
- 'duke/{{distributionName}}-{{jibSpecName}}:latest'
matchers:
# match by platform
platform: 'linux_musl-x86_64'
```
--------------------------------
### Gofish Configuration Example
Source: https://jreleaser.org/guide/latest/reference/packagers/gofish.html
This Lua configuration defines package details for a distribution, including version, download URLs, and resource paths for different platforms. It is used to generate a GoFish-compatible formula.
```lua
local name = "app"
local version = "1.2.3"
food = {
name = name,
description = "Awesome App",
license = "Apache-2.0"
homepage = "https://acme.com/app",
version = version,
packages = {
{
os = "darwin",
arch = "amd64",
url = "https://github.com/duke/" .. name .. "/releases/download/v" .. version .. "/" .. name .. "-" .. version .. ".zip",
sha256 = "d619026717cf198ea328e1dd8db5a3498bc69138830772bcd5fe06b2d9367482",
resources = {
{
path = name .. "-" .. version .. "/bin/" .. name,
installpath = "bin/" .. name,
executable = true
}
}
},
{
os = "darwin",
arch = "arm64",
url = "https://github.com/duke/" .. name .. "/releases/download/v" .. version .. "/" .. name .. "-" .. version .. ".zip",
sha256 = "d619026717cf198ea328e1dd8db5a3498bc69138830772bcd5fe06b2d9367482",
resources = {
{
path = name .. "-" .. version .. "/bin/" .. name,
installpath = "bin/" .. name,
executable = true
}
}
},
{
os = "linux",
arch = "amd64",
url = "https://github.com/duke/" .. name .. "/releases/download/v" .. version .. "/" .. name .. "-" .. version .. ".zip",
sha256 = "d619026717cf198ea328e1dd8db5a3498bc69138830772bcd5fe06b2d9367482",
resources = {
{
path = name .. "-" .. version .. "/bin/" .. name,
installpath = "bin/" .. name,
executable = true
}
}
},
{
os = "linux",
arch = "arm64",
url = "https://github.com/duke/" .. name .. "/releases/download/v" .. version .. "/" .. name .. "-" .. version .. ".zip",
sha256 = "d619026717cf198ea328e1dd8db5a3498bc69138830772bcd5fe06b2d9367482",
resources = {
{
path = name .. "-" .. version .. "/bin/" .. name,
installpath = "bin/" .. name,
executable = true
}
}
},
{
os = "windows",
arch = "amd64",
url = "https://github.com/duke/" .. name .. "/releases/download/v" .. version .. "/" .. name .. "-" .. version .. ".zip",
sha256 = "d619026717cf198ea328e1dd8db5a3498bc69138830772bcd5fe06b2d9367482",
resources = {
{
path = name .. "-" .. version .. \"\\bin\\\" .. name .. ".bat",
installpath = "bin\\" .. name .. ".bat",
executable = true
}
}
},
{
os = "windows",
arch = "arm64",
url = "https://github.com/duke/" .. name .. "/releases/download/v" .. version .. "/" .. name .. "-" .. version .. ".zip",
sha256 = "d619026717cf198ea328e1dd8db5a3498bc69138830772bcd5fe06b2d9367482",
resources = {
{
path = name .. "-" .. version .. \"\\bin\\\" .. name .. ".bat",
installpath = "bin\\" .. name .. ".bat",
executable = true
}
}
},
}
}
```
--------------------------------
### Install JReleaser with Flatpak
Source: https://jreleaser.org/guide/latest/install.html
Install JReleaser as a Flatpak package for user-level installation. Allows running JReleaser commands after installation.
```bash
flatpak install --user flathub org.jreleaser.cli
flatpak run org.jreleaser.cli
```
--------------------------------
### Configure Winget Upgrade Behavior
Source: https://jreleaser.org/guide/latest/reference/packagers/winget.html
Specifies the upgrade method for the installer. Valid values are INSTALL and UNINSTALL_PREVIOUS. Defaults to INSTALL.
```xml
INSTALL
```
--------------------------------
### Install JReleaser on Fedora
Source: https://jreleaser.org/guide/latest/install.html
Install JReleaser on Fedora systems using COPR repositories. This involves enabling the repository and then installing the package.
```bash
dnf install dnf-plugins-core
dnf copr enable aalmiray/jreleaser
dnf install jreleaser
```
--------------------------------
### FTP Upload Configuration Example
Source: https://jreleaser.org/guide/latest/reference/upload/ftp.html
Configure FTP upload settings including host, port, credentials, and paths. Supports environment variables for sensitive information and template evaluation for dynamic paths.
```yaml
# __
upload:
# __
ftp:
# Uploaders require a name.
# __
app:
# Enables or disables the uploader.
# Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `NEVER`.
# __ __
active: ALWAYS
# Defines the connection timeout in seconds.
# Defaults to `20`.
# __
connectTimeout: 20
# Defines the read timeout in seconds.
# Defaults to `60`.
# __
readTimeout: 60
# Upload files.
# Defaults to `true`.
# __
files: true
# Upload distribution artifacts.
# Defaults to `true`.
# __
artifacts: true
# Release checksum files.
# Defaults to `true`.
# __
checksums: true
# Upload signatures.
# Defaults to `true`.
# __
signatures: true
# Upload catalogs.
# Defaults to `true`.
# __
catalogs: true
# Additional properties used when evaluating templates.
# __
extraProperties:
# Key will be capitalized and prefixed with `ftp`, i.e, `ftpFoo`.
foo: bar
# Host where the FTP service is enabled.
# __ __
host: uploads.acme.com
# Port number of FTP service.
# Defaults to `21`.
# __ __
port: 21
# The username required for authorization.
# __ __
username: __USE_ENVIRONMENT_VARIABLE__
# Password for login into the FTP service.
# __ __
password: __USE_ENVIRONMENT_VARIABLE__
# Path where artifacts will be uploaded.
# __ __
path: 'uploads/{{projectName}}/{{tagName}}/{{artifactFile}}'
# An HTTP/HTTPS URL from where artifacts may be downloaded.
# __ __
downloadUrl: 'https://download.acme.com/{{projectName}}/{{tagName}}/{{artifactFile}}'
```
--------------------------------
### Assemble Java Helloworld App (Classpath)
Source: https://jreleaser.org/guide/latest/examples/java/binary.html
Use this command to assemble the Java 'helloworld' application when packaging with the classpath mode. Ensure JReleaser is configured and dependencies are met.
```bash
./mvnw verify
./mvnw -Pjdks
jreleaser assemble
```
--------------------------------
### Install JReleaser with Scoop
Source: https://jreleaser.org/guide/latest/install.html
Install JReleaser using Scoop on Windows. Requires adding the JReleaser bucket and then installing the package. Requires Java 8 or later.
```powershell
scoop bucket add jreleaser https://github.com/jreleaser/scoop-jreleaser.git
scoop install jreleaser
```
--------------------------------
### Setup Discovered JDKs with JReleaser Maven Plugin
Source: https://jreleaser.org/guide/latest/tools/jdks-maven.html
Fetches, downloads, and extracts specified JDK distributions. This output is generated by the `jdks:setup-disco` goal.
```bash
[INFO] --- jdks-maven-plugin:1.24.0:setup-disco (default-cli) @ app ---
[INFO] Fetching [name='zulu11Linux', version='11.0.11', archiveType='zip', distribution='zulu', platform='linux-x86_64', packageType='jdk', javafxBundled='false']
[INFO] Downloading https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-linux_x64.zip
[INFO] Extracting zulu11.48.21-ca-jdk11.0.11-linux_x64.zip
[INFO] Fetching [name='zulu11Osx', version='11.0.11', archiveType='zip', distribution='zulu', platform='osx-x86_64', packageType='jdk', javafxBundled='false']
[INFO] Downloading https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-macosx_x64.zip
[INFO] Extracting zulu11.48.21-ca-jdk11.0.11-macosx_x64.zip
[INFO] Fetching [name='zulu11Windows', version='11.0.11', archiveType='zip', distribution='zulu', platform='windows-x86_64', packageType='jdk', javafxBundled='false']
[INFO] Downloading https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-win_x64.zip
[INFO] Extracting zulu11.48.21-ca-jdk11.0.11-win_x64.zip
Copied!
```
--------------------------------
### Install JReleaser with Sdkman
Source: https://jreleaser.org/guide/latest/install.html
Install JReleaser using Sdkman. Requires Java 8 or later.
```bash
sdk install jreleaser
```
--------------------------------
### JReleaser Prepare Command Help
Source: https://jreleaser.org/guide/latest/tools/jreleaser-cli.html
Displays the help message for the 'prepare' command, outlining all available options and their usage.
```bash
$ jreleaser prepare -h
```
--------------------------------
### Set Flatpak Runtime and SDK
Source: https://jreleaser.org/guide/latest/reference/packagers/flatpak.html
Configure the Flatpak runtime and SDK. Valid values include FREEDESKTOP, GNOME, KDE, ELEMENTARY.
```toml
runtime = "FREEDESKTOP"
runtimeVersion = "21.08"
```
--------------------------------
### Install JReleaser with Winget
Source: https://jreleaser.org/guide/latest/install.html
Install JReleaser using Winget on Windows. This is a command-line package manager for Windows.
```powershell
winget install jreleaser
```
--------------------------------
### Install JReleaser with Chocolatey
Source: https://jreleaser.org/guide/latest/install.html
Install JReleaser using Chocolatey on Windows. Requires Java 8 or later.
```powershell
choco install jreleaser
```
--------------------------------
### Install JReleaser with Homebrew Tap
Source: https://jreleaser.org/guide/latest/install.html
Install JReleaser using a Homebrew tap. All versions are available from the tap.
```bash
brew install jreleaser/tap/jreleaser
```
--------------------------------
### Prepare All Distributions
Source: https://jreleaser.org/guide/latest/tools/jreleaser-cli.html
Executes the prepare step for all configured distributions without any specific filters.
```bash
$ jreleaser prepare
```
--------------------------------
### Buddy Pipeline: Build with Docker
Source: https://jreleaser.org/guide/latest/continuous-integration/buddy.html
Configure a Buddy pipeline to build a project using Docker. This example uses Maven for the build step and a dedicated JReleaser Docker image for the release process.
```yaml
- pipeline: "Build with Docker"
# manual trigger
on: "CLICK"
refs:
- "refs/heads/main"
priority: "NORMAL"
fail_on_prepare_env_warning: true
actions:
- action: "Build"
type: "BUILD"
working_directory: "/buddy/"
docker_image_name: "library/maven"
docker_image_tag: "latest"
execute_commands:
- "./mvnw -B verify"
cached_dirs:
- "/root/.m2/repository"
volume_mappings:
- "/:/buddy/"
shell: "BASH"
- action: "JReleaser"
type: "RUN_DOCKER_CONTAINER"
docker_image_name: "jreleaser/jreleaser-alpine"
docker_image_tag: "latest"
inline_commands: "release"
volume_mappings:
# Map sources into '/workspace'
- "/:/workspace"
shell: "SH"
```
--------------------------------
### Buddy Pipeline: Build with Script
Source: https://jreleaser.org/guide/latest/continuous-integration/buddy.html
Configure a Buddy pipeline to build a project using a script. This example uses Maven and demonstrates setting up actions for building and running JReleaser within a Bash shell.
```yaml
- pipeline: "Build with Script"
# manual trigger
on: "CLICK"
refs:
- "refs/heads/main"
priority: "NORMAL"
fail_on_prepare_env_warning: true
actions:
- action: "Build"
type: "BUILD"
working_directory: "/buddy/"
docker_image_name: "library/maven"
docker_image_tag: "latest"
execute_commands:
- "./mvnw -B verify"
cached_dirs:
- "/root/.m2/repository"
volume_mappings:
- "/:/buddy/"
shell: "BASH"
- action: "JReleaser"
type: "BUILD"
disabled: true
working_directory: "/buddy/"
docker_image_name: "library/ubuntu"
docker_image_tag: "18.04"
execute_commands:
- "curl -sL https://git.io/get-jreleaser > get_jreleaser.java"
- "java get_jreleaser.java"
- "java -jar jreleaser-cli.jar --version"
- "java -jar jreleaser-cli.jar full-release"
setup_commands:
# Install curl & Java 11
- "apt-get update && apt-get -y install curl openjdk-11-jdk"
volume_mappings:
- "/:/buddy/"
shell: "BASH"
```
--------------------------------
### Install JReleaser with Macports
Source: https://jreleaser.org/guide/latest/install.html
Install JReleaser using the Macports package manager. Requires Java 8 or later.
```bash
port install jreleaser
```
--------------------------------
### Install JReleaser with AppImage
Source: https://jreleaser.org/guide/latest/install.html
Download and make executable the JReleaser AppImage. This is a self-contained executable that does not require system-level installation.
```bash
curl https://github.com/jreleaser/jreleaser-appimage/releases/download/v1.24.0/jreleaser-1.24.0-x86_64.AppImage --output jreleaser
chmod +x jreleaser
```
--------------------------------
### Assemble Java Helloworld App (Modulepath)
Source: https://jreleaser.org/guide/latest/examples/java/binary.html
Use this command to assemble the Java 'helloworld' application when packaging with the modulepath mode. This requires a specific configuration file for JReleaser.
```bash
./mvnw verify
./mvnw -Pjdks
jreleaser assemble --config-file jreleaser-modules.yml
```
--------------------------------
### SCP Downloader Configuration Example
Source: https://jreleaser.org/guide/latest/reference/download/scp.html
This YAML configuration block defines how to set up the SCP downloader. It includes options for enabling the downloader, setting connection timeouts, specifying host and port, and configuring authentication using environment variables for username, password, public/private keys, and passphrase. It also details how to specify assets to download, including their remote input path and local output path, with options for unpacking.
```yaml
# __
download:
# __
scp:
# Downloaders require a name.
# __
app:
# Enables or disables the downloader.
# Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `NEVER`.
# __ __
active: ALWAYS
# Defines the connection timeout in seconds.
# Defaults to `20`.
# __
connectTimeout: 20
# Defines the read timeout in seconds.
# Defaults to `60`.
# __
readTimeout: 60
# Additional properties used when evaluating templates.
# __
extraProperties:
# Key will be capitalized and prefixed with `scp`, i.e, `scpFoo`.
foo: bar
# Host where the SCP service is enabled.
# __ __
host: downloads.acme.com
# Port number of SCP service.
# Defaults to `22`.
# __ __
port: 22
# The username required for authorization.
# __ __
username: __USE_ENVIRONMENT_VARIABLE__
# Password for login into the SCP service.
# __ __
password: __USE_ENVIRONMENT_VARIABLE__
# The public SSH key.
# __ __
publicKey: __USE_ENVIRONMENT_VARIABLE__
# The private SSH key.
# __ __
privateKey: __USE_ENVIRONMENT_VARIABLE__
# The passphrase required to read private keys.
# __ __
passphrase: __USE_ENVIRONMENT_VARIABLE__
# The remote server's SSH fingerprint.
# __ __
fingerprint: __USE_ENVIRONMENT_VARIABLE__
# A list of assets to be downloaded.
# __
assets:
# Full download path to asset.
# __ __
- input: '/logos/logo-256x256.png'
# Local path where asset will be downloaded to.
# Defaults to `#{jreleaser.downloadDirectory}/#{downloader.name}`.
# __ __
output: '{{projectName}}.png'
# Unpack options
# __
unpack:
# Unpack input archive when `true`.
# Defaults to `false`.
# __
enabled: false
# Skip the archive's root entry from the unpacked directory when `true`.
# Defaults to `false`.
# __
skipRootEntry: false
```
--------------------------------
### Generated Changelog Example
Source: https://jreleaser.org/guide/latest/reference/release/changelog.html
An example of a changelog generated by JReleaser using the conventional commits format with categorized scopes.
```markdown
## Changelog
## 🚀 Features
**core**
- 865592a Add arguments to Main class
**release**
- fa0d451 Add JReleaser configuration
## 🐛 Fixes
**release**
- 072c519 Update JReleaser configuration
## 🛠 Build
**assembly**
- a8c6140 Add Maven assembly descriptor
**release**
- 86c03d0 Update JReleaser configuration
- 54e0199 Use fetch-depth=0 when checking out on release
- 25789a7 Setup build & release workflows
**unscoped**
- 5c18c47 Add Maven wrapper files
- 4cc2751 Add sources
- d751ebe Add license file
---
- 51c3234 Init repository
## Contributors
We'd like to thank the following people for their contributions:
Andres Almiray
```