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.
      # Valid 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

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

      # Attach the current platform to the archiveName.
      # 
      attachPlatform: true

      # Set of archive formats to use.
      # Valid values are [`ZIP`, `TAR`, `TGZ`, `TAR_GZ`].
      # 
      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

          # 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.
  # Valid 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

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

  # 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.
  # 
  attachPlatform = true

  # Set of archive formats to use.
  # Valid values are [`ZIP`, `TAR`, `TGZ`, `TAR_GZ`].
  # 
  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"

    # 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.
        // Valid 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,

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

        // Set of archive formats to use.
        // Valid values are [`ZIP`, `TAR`, `TGZ`, `TAR_GZ`].
        // 
        "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",

            // 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.
          Valid 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>

        <!--
          Additional properties used when evaluating templates.
           
        -->
        <extraProperties>
          <!--
            Key will be capitalized and prefixed with `archive`, i.e, `archiveFoo`.
          -->
          <foo>bar</foo>
        </extraProperties>

        <!--
          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.
          Define only if the application is modular.
          
        -->
        <attachPlatform>true</attachPlatform>

        <!--
          Set of archive formats to use.
          Valid values are [`ZIP`, `TAR`, `TGZ`, `TAR_GZ`].
          
        -->
        <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>

            <!--
              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.
        // Valid 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

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

        // 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.
        // Define only if the application is modular.
        // 
        attachPlatform = true

        // Set of archive formats to use.
        // Valid values are [`ZIP`, `TAR`, `TGZ`, `TAR_GZ`].
        // 
        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'

          // 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