Archive

Creates a binary distribution archive.

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

# 
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, NATIVE_IMAGE, NATIVE_PACKAGE, BINARY].
      # 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`, `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, NATIVE_IMAGE, NATIVE_PACKAGE, BINARY].
  # 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`, `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, NATIVE_IMAGE, NATIVE_PACKAGE, BINARY].
        // 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`, `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, NATIVE_IMAGE, NATIVE_PACKAGE, BINARY].
          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`, `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'
          ]
        }

        // Additional properties used when evaluating templates.
        // Key will be capitalized and prefixed with `archive`, i.e, `archiveFoo`.
        //  
        extraProperties.put('foo', 'bar')

        // 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, NATIVE_IMAGE, NATIVE_PACKAGE, BINARY].
        // 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`, `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

.
├── BUILD
├── LICENSE
├── README
└── target
    └── release
        └── app

And this assembly configuration

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

project:
  version: 1.0.0

assemble:
  archive:
    app:
      active: ALWAYS
      fileSets:
        - input: '.'
          includes:
            - 'LICENSE'
            - 'README'
        - input: 'target/release'
          output: 'bin'
[project]
  version = "1.0.0"

[assemble.archive.app]
  active = "ALWAYS"
  [[assemble.archive.app.fileSets]]
    input = "."
    includes = ["LICENSE", "README"]
  [[assemble.archive.app.fileSets]]
    input = "target/release"
    output = "bin"
{
  "project": {
    "version": "1.0.0"
  },
  "assemble": {
    "archive": {
      "app": {
        "active": "ALWAYS",
        "fileSets": [
          {
            "input": ".",
            "includes": ["LICENSE", "README"]
          },
          {
            "input": "target/release",
            "output": "bin"
          }
        ]
      }
    }
  }
}
<jreleaser>
  <project>
    <version>1.0.0</version>
  </project>
  <assemble>
    <archive>
      <app>
        <active>ALWAYS</active>
        <fileSets>
          <fileSet>
            <input>.</input>
            <includes>
              <include>LICENSE</include>
              <include>README</include>
            </includes>
          </fileSet>
          <fileSet>
            <input>target/release</input>
            <output>bin</output>
          </fileSet>
        </fileSets>
      </app>
    </archive>
  </assemble>
</jreleaser>
jreleaser {
  project {
    version = '1.0.0'
  }
  assemble {
    archive {
      app {
        active = 'ALWAYS'
        fileSet {
          input = '.'
          includes = ['LICENSE', 'README']
        }
        fileSet {
          input = 'target/release'
          output = 'bin'
        }
      }
    }
  }
}

Results in an assembled Zip archive named app-1.0.0.zip with the following entries

app-1.0.0
├── LICENSE
├── README
└── bin
    └── app