Distributions

Distributions define artifacts that may be published using supported packages and announced with supported announcers.

Each distribution is responsible for defining a unique name and a list of artifacts that belong to it.

A distribution requires at least 1 artifact to be listed.

Distributions inherit the configuration specified in the Packagers block and may override it.

Distributions have a type that enables or disables additional features. These types are:

Configuration

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

# 
distributions:
  # A named distribution
  # 
  app:

    # Enables or disables the distribution.
    # Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
    # Defaults to `ALWAYS`.
    #  
    active: ALWAYS

    # The distribution type.
    # Used to determine packager templates.
    # Supported values are: [`JAVA_BINARY`, `SINGLE_JAR`, `JLINK`, `BINARY`, `FLAT-BINARY`, `NATIVE_PACKAGE`].
    # 
    type: JAVA_BINARY

    # The stereotype of this distribution.
    # Supported values are [`NONE`, `CLI`, `DESKTOP`, `WEB`, `MOBILE`].
    # Defaults to `#{project.stereotype}`.
    # 
    stereotype: CLI

    # 
    executable:
      # Name of the executable launcher.
      # If left undefined, will use `#{distribution.name}`.
      # 
      name: app

      # Executable extension on Linux/MacOS.
      # If left undefined, value will be left empty.
      # 
      unixExtension: sh

      # Executable extension on Windows.
      # If left undefined, will use `bat`.
      # 
      windowsExtension: cmd

    # A list of tags.
    # 
    tags:
      - cli
      - awesome

    # Additional properties used when evaluating templates.
    #  
    extraProperties:
      # Key will be capitalized and prefixed with `distribution`, i.e, `distributionFoo`.
      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

    # A list of artifacts.
    # At least on entry must be present.
    #  
    artifacts:
      - path: path/to/{{distributionName}}-{{projectVersion}}.zip
      - path: path/to/{{distributionName}}-{{projectVersion}}-mac.zip
        platform: osx
      - path: path/to/{{distributionName}}-{{projectVersion}}-win.zip
        platform: windows

    # 
    java:
      # 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

      # The application's entry point.
      # If left undefined, will use `#{project.java.mainClass}`.
      # 
      mainClass: com.acme.Main

      # 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
# A named distribution
# 
[distributions.app]

  # Enables or disables the distribution.
  # Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
  # Defaults to `ALWAYS`.
  #  
  active = "ALWAYS"

  # The distribution type.
  # Used to determine packager templates.
  # Supported values are: [`JAVA_BINARY`, `SINGLE_JAR`, `JLINK`, `BINARY`, `FLAT-BINARY`, `NATIVE_PACKAGE`].
  # 
  type = "JAVA_BINARY"

  # The stereotype of this distribution.
  # Supported values are [`NONE`, `CLI`, `DESKTOP`, `WEB`, `MOBILE`].
  # Defaults to `#{project.stereotype}`.
  # 
  stereotype = "CLI"

  # 
  [distributions.app.executable]
    # Name of the executable launcher.
    # If left undefined, will use `#{distribution.name}`.
    # 
    name = "app"

    # Executable extension on Linux/MacOS.
    # If left undefined, value will be left empty.
    # 
    unixExtension = "sh"

    # Executable extension on Windows.
    # If left undefined, will use `bat`.
    # 
    windowsExtension = "cmd"

  # A list of tags.
  # 
  tags = ["cli", "awesome"]

  # Additional properties used when evaluating templates.
  #  
  extraProperties.foo = "bar"
  # Key will be capitalized and prefixed with `distribution`, i.e, `distributionFoo`.

  # Key value pairs.
  # Keys match a full platform or an os.name, os.arch.
  # Same rules apply as in Platform.
  # 
  [distributions.app.platform.replacements]
    osx-x86_64 = "mac"
    aarch_64 = "aarch64"
    x86_64 = "amd64"
    linux_musl = "alpine"

  # A list of artifacts.
  # At least on entry must be present.
  #  
  artifacts = [
    { path = "path/to/{{distributionName}}-{{projectVersion}}.zip" },
    { path = "path/to/{{distributionName}}-{{projectVersion}}-mac.zip", platform = "osx" },
    { path = "path/to/{{distributionName}}-{{projectVersion}}-win.zip", platform = "windows" }
  ]

  # 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"

  # The application's entry point.
  # If left undefined, will use `#{project.java.mainClass}`.
  # 
  java.mainClass = "com.acme.Main"

  # 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`.
{
  // 
  "distributions": {
    // A named distribution
    // 
    "app": {

      // Enables or disables the distribution.
      // Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      // Defaults to `ALWAYS`.
      //  
      "active": "ALWAYS",

      // The distribution type.
      // Used to determine packager templates.
      // Supported values are: [`JAVA_BINARY`, `SINGLE_JAR`, `JLINK`, `BINARY`, `FLAT-BINARY`, `NATIVE_PACKAGE`].
      // 
      "type": "JAVA_BINARY",

      // The stereotype of this distribution.
      // Supported values are [`NONE`, `CLI`, `DESKTOP`, `WEB`, `MOBILE`].
      // Defaults to `#{project.stereotype}`.
      // 
      "stereotype": "CLI",

      // 
      "executable":  {
        // Name of the executable launcher.
        // If left undefined, will use `#{distribution.name}`.
        // 
        "name": "app",

        // Executable extension on Linux/MacOS.
        // If left undefined, value will be left empty.
        // 
        "unixExtension": "sh",

        // Executable extension on Windows.
        // If left undefined, will use `bat`.
        // 
        "windowsExtension": "cmd"
      },

      // A list of tags.
      // 
      "tags": [
         "cli",
         "awesome"
      ],

      // Additional properties used when evaluating templates.
      //  
      "extraProperties": {
        // Key will be capitalized and prefixed with `distribution`, i.e, `distributionFoo`.
        "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"
        }
      },

      // A list of artifacts.
      // At least on entry must be present.
      //  
      "artifacts": [
        {
          "path": "path/to/{{distributionName}}-{{projectVersion}}.zip"
        },
        {
          "path": "path/to/{{distributionName}}-{{projectVersion}}-mac.zip",
          "platform": "osx"
        },
        {
          "path": "path/to/{{distributionName}}-{{projectVersion}}-win.zip",
          "platform": "windows"
        }
      ],

      // 
      "java": {
        // 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",

        // The application's entry point.
        // If left undefined, will use `#{project.java.mainClass}`.
        // 
        "mainClass": "com.acme.Main",

        // 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"
        }
      }
    }
  }
}
<jreleaser>
  <!--
    
  -->
  <distributions>
    <!--
      A named distribution
      
    -->
    <app>

      <!--
        Enables or disables the distribution.
        Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
        Defaults to `ALWAYS`.
         
      -->
      <active>ALWAYS</active>

      <!--
        The distribution type.
        Used to determine packager templates.
        Supported values are>[`JAVA_BINARY`, `SINGLE_JAR`, `JLINK`, `BINARY`, `FLAT-BINARY`, `NATIVE_PACKAGE`].
        
      -->
      <type>JAVA_BINARY</type>

      <!--
        The stereotype of this distribution.
        Supported values are [`NONE`, `CLI`, `DESKTOP`, `WEB`, `MOBILE`].
        Defaults to `#{project.stereotype}`.
        
      -->
      <stereotype>CLI</stereotype>

      <!--
        
      -->
      <executable>
        <!--
          Name of the executable launcher.
          If left undefined, will use `#{distribution.name}`.
          
        -->
        <name>app</name>

        <!--
          Executable extension on Linux/MacOS.
          If left undefined, value will be left empty.
          
        -->
        <unixExtension>sh</unixExtension>

        <!--
          Executable extension on Windows.
          If left undefined, will use `bat`.
          
        -->
        <windowsExtension>cmd</windowsExtension>
      </executable>

      <!--
        A list of tags.
        
      -->
      <tags>
        <tag>cli</tag>
        <tag>awesome</tag>
      </tags>

      <!--
        Additional properties used when evaluating templates.
         
      -->
      <extraProperties>
        <!--
          Key will be capitalized and prefixed with `distribution`, i.e, `distributionFoo`.
        -->
        <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>

      <!--
        A list of artifacts.
        At least on entry must be present.
         
      -->
      <artifacts>
        <artifact>
          <path>path/to/{{distributionName}}-{{projectVersion}}.zip</path>
        </artifact>
        <artifact>
          <path>path/to/{{distributionName}}-{{projectVersion}}-mac.zip</path>
          <platform>osx</platform>
        </artifact>
        <artifact>
          <path>path/to/{{distributionName}}-{{projectVersion}}-win.zip</path>
          <platform>windows</platform>
        </artifact>
      </artifacts>

      <!--
        
      -->
      <java>
        <!--
          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>

        <!--
          The application's entry point.
          If left undefined, will use `#{project.java.mainClass}`.
          
        -->
        <mainClass>com.acme.Main</mainClass>

        <!--
          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>
    </app>
  </distributions>
</jreleaser>
jreleaser {
  // 
  distributions {
    // A named distribution
    // 
    app {

      // Enables or disables the distribution.
      // Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      // Defaults to `ALWAYS`.
      //  
      active = 'ALWAYS'

      // The distribution type.
      // Used to determine packager templates.
      // Supported values are = [`JAVA_BINARY`, `SINGLE_JAR`, `JLINK`, `BINARY`, `FLAT-BINARY`, `NATIVE_PACKAGE`].
      // 
      distributionType = 'JAVA_BINARY'

      // The stereotype of this distribution.
      // Supported values are [`NONE`, `CLI`, `DESKTOP`, `WEB`, `MOBILE`].
      // Defaults to `#{project.stereotype}`.
      // 
      stereotype = 'CLI'

      // 
      executable {
        // Name of the executable launcher.
        // If left undefined, will use `#{distribution.name}`.
        // 
        name = 'app'

        // Executable extension on Linux/MacOS.
        // If left undefined, value will be left empty.
        // 
        unixExtension = 'sh'

        // Executable extension on Windows.
        // If left undefined, will use `bat`.
        // 
        windowsExtension = 'cmd'
      }

      // A list of tags.
      // 
      tags = ['cli', 'awesome']

      // Additional properties used when evaluating templates.
      // Key will be capitalized and prefixed with `distribution`, i.e, `distributionFoo`.
      //  
      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'
        ]
      }

      // A list of artifacts.
      // At least on entry must be present.
      //  
      artifact {
        path = "path/to/{{distributionName}}-{{projectVersion}}.zip"
      }
      artifact {
        path = "path/to/{{distributionName}}-{{projectVersion}}-mac.zip"
        platform = 'osx'
      }
      artifact {
        path = "path/to/{{distributionName}}-{{projectVersion}}-win.zip"
        platform = 'windows'
      }

      // 
      java {
        // 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'

        // The application's entry point.
        // If left undefined, will use `#{project.java.mainClass}`.
        // 
        mainClass = 'com.acme.Main'

        // 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')
      }
    }
  }
}

It’s recommended to list universal artifacts first, then platform specific.

The value of platform is dictated by the normalized values detected by os-maven-plugin. You may use the plain platform value or append a arch classifier. The following values are currently recognized:

platform

aix, hpux, os400, linux, linux_musl, osx, freebsd, openbsd, netbsd, sunos, windows, zos.

arch

x86_64, x86_32, itanium_64, itanium_32, sparc_32, sparc_64, arm_32, aarch_64, mips_32, mipsel_32, mips_64, mipsel_64, ppc_32, ppcle_32, ppc_64, ppcle_64, s390_32, s390_64, riscv

Examples:

  • osx

  • osx-aarch_64

  • windows

  • linux

  • linux-x86_64

Use linux_musl for artifacts that target Alpine Linux.

Platform detection may be overridden by defining an environment variable or a System property named JRELEASER_PLATFORM_OVERRIDE.

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.distributions.${name}.active
jreleaser.distributions.active

JRELEASER_DISTRIBUTIONS_${name}_ACTIVE
JRELEASER_DISTRIBUTIONS_ACTIVE

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

FOOBAR

fooBar

foobar

FOOBAR

foo bar

foo.bar

FOO_BAR

foo-bar

foo.bar

FOO_BAR

foo_bar

foo.bar

FOO_BAR

foo.bar

foo.bar

FOO_BAR