Homebrew

The brew section specifies how the formula should be created. You can check the Homebrew documentation and the formula cookbook and cask-cookbook for more details.

The following artifact extensions are supported by this packager for creating formular:

  • .jar

  • .zip

The following artifact extensions are supported by this packager for creating casks:

  • .dmg

  • .pkg

  • .zip

Publication of snapshots is not allowed.

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

# 
packagers:
  # 
  brew:
    # Enables or disables Homebrew.
    # Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
    # Defaults to `NEVER`.
    # 
    active: ALWAYS

    # Let the release continue if the packager fails.
    # Defaults to `false`.
    # 
    continueOnError: true

    # Custom download URL.
    #  
    downloadUrl: https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}

    # Additional properties used when evaluating templates.
    #  
    extraProperties:
      # Key will be capitalized and prefixed with `brew`, i.e, `brewFoo`.
      foo: bar

    # Directory with file templates used to prepare the Homebrew distribution.
    # Defaults to `src/jreleaser/distributions/${distribution.name}/brew`.
    # If specified, path must exist.
    # 
    templateDirectory: path/to/brew/templates

    # Git author used to commit to the repository.
    # 
    commitAuthor:
      # Name used when authoring commits.
      # Defaults to `jreleaserbot`.
      # 
      name: jreleaserbot

      # E-mail used when authoring commits.
      # Defaults to `jreleaser@kordamp.org`.
      # 
      email: jreleaser@kordamp.org

    # Git repository to push the formula to.
    # Defaults are shown.
    # 
    tap:
      # Enables or disables the tap.
      # Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      # Defaults to `RELEASE`.
      # 
      active: ALWAYS


      # The owner of the tap.
      # Defaults to the same owner as the release repository.
      # 
      owner: duke

      # The name of the tap.
      # Defaults to `homebrew-tap`.
      # 
      name: homebrew-tap

      # The tag associated with the formula.
      # If left unspecified, will use `{{tagName}}`.
      #  
      tagName: '{{distributionName}} {{tagName}}'

      # The target branch to use.
      # May define a `JRELEASER_HOMEBREW_${GIT}_BRANCH` environment variable instead.
      # Defaults to the branch pointed by HEAD.
      #  
      branch: HEAD

      # Username used for authoring commits. Must have write access to the tap.
      # If left unspecified, the `JRELEASER_HOMEBREW_${GIT}_USERNAME`
      # environment variable must be defined.
      # Defaults to the same username as the release repository.
      #  
      username: duke

      # Password or OAuth token with write access to the tap.
      # If left unspecified, the `JRELEASER_HOMEBREW_${GIT}_TOKEN`
      # environment variable must be defined.
      #  
      token: __DO_NOT_SET_HERE__

      # Message when committing to the tap.
      # If left unspecified, `{{distributionName}} {{tagName}}` will be used.
      #  
      commitMessage: '{{distributionName}} {{tagName}}'

    # The class name of the generated formula.
    # If left unspecified, will use `{{projectNameCapitalized}}`.
    #  
    formulaName: App

    # Create a formula that supports OSX & Linux.
    # Applicable to distributions of type [JLINK, NATIVE_IMAGE, BINARY].
    # Default is `false`.
    # 
    multiPlatform: false

    # Customize the livecheck block.
    # Default is empty.
    #  
    livecheck:
      - 'url "https://host/sparkle/appcast-release.xml"'
      - 'strategy :sparkle'

    # A map of Homebrew dependencies.
    # The key `openjdk@${java.version}` will be added automatically if not defined.
    # This can be skipped by adding `skipJava` as an extra property on the distribution.
    # 
    dependencies:
      # key in symbol format
      # mapped as `depends_on :key1 => "value1"`
      ':key1': value1

      # plain key
      # mapped as `depends_on "key2" => "value2"`
      key2: value2

      # key in symbol format without value
      # mapped as `depends_on :key3`
      ':key3': 'null'

      # plain key without value
      # mapped as `depends_on "key4"`
      key4: 'null'

    # Cask configuration.
    # Requires artifact with extension `.dmg` or `.pkg`.
    # Defaults are shown.
    # 
    cask:

      # Favors producing a cask instead of a formula.
      # Default is `false`.
      # 
      enabled: true

      # The class name of the generated cask.
      # If left unspecified, will use `{{projectName}}`.
      #  
      name: app

      # The name of the generated cask.
      # If left unspecified, will use `{{brewFormulaName}}`.
      #  
      displayName: App

      # Relative path to the .pkg file.
      # If left unspecified, will use the filename of the .pkg file.
      #  
      pkgName: app-1.0.0.pkg

      # Name of the application folder.
      # If left unspecified, will use `{{brewFormulaName}}.app`.
      #  
      appName: App.app

      # URL providing an appcast feed to find updates for this Cask.
      # Default is empty.
      #  
      appcast: https://{{repoHost}}/{{repoOwner}}/{{repoName}}/releases.atom

      # Procedures to uninstall the Cask.
      # 
      uninstall:
        pkgutil:
          - com.acme.app

      # Additional procedures for a more complete uninstall.
      # 
      zap:
        trash:
          - '~/Library/Caches/App'
# 
[packagers.brew]
  # Enables or disables Homebrew.
  # Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
  # Defaults to `NEVER`.
  # 
  active = "ALWAYS"

  # Let the release continue if the packager fails.
  # Defaults to `false`.
  # 
  continueOnError = true

  # Custom download URL.
  #  
  downloadUrl = "https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}"

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

  # Directory with file templates used to prepare the Homebrew distribution.
  # Defaults to `src/jreleaser/distributions/${distribution.name}/brew`.
  # If specified, path must exist.
  # 
  templateDirectory = "path/to/brew/templates"

  # Git author used to commit to the repository.

  # Name used when authoring commits.
  # Defaults to `jreleaserbot`.
  # 
  commitAuthor.name = "jreleaserbot"

  # E-mail used when authoring commits.
  # Defaults to `jreleaser@kordamp.org`.
  # 
  commitAuthor.email = "jreleaser@kordamp.org"

  # Git repository to push the formula to.
  # Defaults are shown.

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


  # The owner of the tap.
  # Defaults to the same owner as the release repository.
  # 
  tap.owner = "duke"

  # The name of the tap.
  # Defaults to `homebrew-tap`.
  # 
  tap.name = "homebrew-tap"

  # The tag associated with the formula.
  # If left unspecified, will use `{{tagName}}`.
  #  
  tap.tagName = "{{distributionName}} {{tagName}}"

  # The target branch to use.
  # May define a `JRELEASER_HOMEBREW_${GIT}_BRANCH` environment variable instead.
  # Defaults to the branch pointed by HEAD.
  #  
  tap.branch = "HEAD"

  # Username used for authoring commits. Must have write access to the tap.
  # If left unspecified, the `JRELEASER_HOMEBREW_${GIT}_USERNAME`
  # environment variable must be defined.
  # Defaults to the same username as the release repository.
  #  
  tap.username = "duke"

  # Password or OAuth token with write access to the tap.
  # If left unspecified, the `JRELEASER_HOMEBREW_${GIT}_TOKEN`
  # environment variable must be defined.
  #  
  tap.token = "__DO_NOT_SET_HERE__"

  # Message when committing to the tap.
  # If left unspecified, `{{distributionName}} {{tagName}}` will be used.
  #  
  tap.commitMessage = "{{distributionName}} {{tagName}}"

  # The class name of the generated formula.
  # If left unspecified, will use `{{projectNameCapitalized}}`.
  #  
  formulaName = "App"

  # Create a formula that supports OSX & Linux.
  # Applicable to distributions of type [JLINK, NATIVE_IMAGE, BINARY].
  # Default is `false`.
  # 
  multiPlatform = false

  # Customize the livecheck block.
  # Default is empty.
  #  
  livecheck = [
     "url 'https://host/sparkle/appcast-release.xml'",
     "strategy :sparkle'"

  # A map of Homebrew dependencies.
  # The key `openjdk@${java.version}` will be added automatically if not defined.
  # This can be skipped by adding `skipJava` as an extra property on the distribution.
  # 
  # key in symbol format
  # mapped as `depends_on :key1 => "value1"`
  dependencies.":key1" = "value1"
  # plain key
  # mapped as `depends_on "key2" => "value2"`
  dependencies.key2 = "value2"
  # key in symbol format without value
  # mapped as `depends_on :key3`
  dependencies.":key3" = "null"
  # plain key without value
  # mapped as `depends_on "key4"`
  dependencies.key4 = "null"

  # Cask configuration.
  # Requires artifact with extension `.dmg` or `.pkg`.
  # Defaults are shown.
  # 

  # Favors producing a cask instead of a formula.
  # Default is `false`.
  # 
  cask.enabled = true

  # The class name of the generated cask.
  # If left unspecified, will use `{{projectName}}`.
  #  
  cask.name = "app"

  # The name of the generated cask.
  # If left unspecified, will use `{{brewFormulaName}}`.
  #  
  cask.displayName = "App"

  # Relative path to the .pkg file.
  # If left unspecified, will use the filename of the .pkg file.
  #  
  cask.pkgName = "app-1.0.0.pkg"

  # Name of the application folder.
  # If left unspecified, will use `{{brewFormulaName}}.app`.
  #  
  cask.appName = "App.app"

  # URL providing an appcast feed to find updates for this Cask.
  # Default is empty.
  #  
  cask.appcast = "https://{{repoHost}}/{{repoOwner}}/{{repoName}}/releases.atom"

  # Procedures to uninstall the Cask.
  # 
  [[packagers.brew.cask.uninstall]]
    pkgutil = ["com.acme.app"]

  # Additional procedures for a more complete uninstall.
  # 
  [[packagers.brew.cask.zap]]
    trash = ["~/Library/Caches/App"]
{
  // 
  "packagers": {
    // 
    "brew": {
      // Enables or disables Homebrew.
      // Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      // Defaults to `NEVER`.
      // 
      "active": "ALWAYS",

      // Let the release continue if the packager fails.
      // Defaults to `false`.
      // 
      "continueOnError": true,

      // Custom download URL.
      //  
      "downloadUrl": "https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}",

      // Additional properties used when evaluating templates.
      //  
      "extraProperties": {
        // Key will be capitalized and prefixed with `brew`, i.e, `brewFoo`.
        "foo": "bar"
      },

      // Directory with file templates used to prepare the Homebrew distribution.
      // Defaults to `src/jreleaser/distributions/${distribution.name}/brew`.
      // If specified, path must exist.
      // 
      "templateDirectory": "path/to/brew/templates",

      // Git author used to commit to the repository.
      // 
      "commitAuthor": {
        // Name used when authoring commits.
        // Defaults to `jreleaserbot`.
        // 
        "name": "jreleaserbot",

        // E-mail used when authoring commits.
        // Defaults to `jreleaser@kordamp.org`.
        // 
        "email": "jreleaser@kordamp.org"
      },

      // Git repository to push the formula to.
      // Defaults are shown.
      // 
      "tap": {
        // Enables or disables the tap.
        // Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
        // Defaults to `RELEASE`.
        // 
        "active": "ALWAYS",


        // The owner of the tap.
        // Defaults to the same owner as the release repository.
        // 
        "owner": "duke",

        // The name of the tap.
        // Defaults to `homebrew-tap`.
        // 
        "name": "homebrew-tap",

        // The tag associated with the formula.
        // If left unspecified, will use `{{tagName}}`.
        //  
        "tagName": "{{distributionName}} {{tagName}}",

        // The target branch to use.
        // May define a `JRELEASER_HOMEBREW_${GIT}_BRANCH` environment variable instead.
        // Defaults to the branch pointed by HEAD.
        //  
        "branch": "HEAD",

        // Username used for authoring commits. Must have write access to the tap.
        // If left unspecified, the `JRELEASER_HOMEBREW_${GIT}_USERNAME`
        // environment variable must be defined.
        // Defaults to the same username as the release repository.
        //  
        "username": "duke",

        // Password or OAuth token with write access to the tap.
        // If left unspecified, the `JRELEASER_HOMEBREW_${GIT}_TOKEN`
        // environment variable must be defined.
        //  
        "token": "__DO_NOT_SET_HERE__",

        // Message when committing to the tap.
        // If left unspecified, `{{distributionName}} {{tagName}}` will be used.
        //  
        "commitMessage": "{{distributionName}} {{tagName}}"
      },

      // The class name of the generated formula.
      // If left unspecified, will use `{{projectNameCapitalized}}`.
      //  
      "formulaName": "App",

      // Create a formula that supports OSX & Linux.
      // Applicable to distributions of type [JLINK, NATIVE_IMAGE, BINARY].
      // Default is `false`.
      // 
      "multiPlatform": false,

      // Customize the livecheck block.
      // Default is empty.
      //  
      "livecheck": [
        "url 'https://host/sparkle/appcast-release.xml'",
        "strategy :sparkle"
      ],

      // A map of Homebrew dependencies.
      // The key `openjdk@${java.version}` will be added automatically if not defined.
      // This can be skipped by adding `skipJava` as an extra property on the distribution.
      // 
      "dependencies": {
        // key in symbol format
        // mapped as `depends_on :key1 => "value1"`
        ":key1": "value1",

        // plain key
        // mapped as `depends_on "key2" => "value2"`
        "key2": "value2",

        // key in symbol format without value
        // mapped as `depends_on :key3`
        ":key3": "null",

        // plain key without value
        // mapped as `depends_on "key4"`
        "key4": "null"
      },

      // Cask configuration.
      // Requires artifact with extension `.dmg` or `.pkg`.
      // Defaults are shown.
      // 
      "cask": {

        // Favors producing a cask instead of a formula.
        // Default is `false`.
        // 
        "enabled": true,

        // The class name of the generated cask.
        // If left unspecified, will use `{{projectName}}`.
        //  
        "name": "app",

        // The name of the generated cask.
        // If left unspecified, will use `{{brewFormulaName}}`.
        //  
        "displayName": "App",

        // Relative path to the .pkg file.
        // If left unspecified, will use the filename of the .pkg file.
        //  
        "pkgName": "app-1.0.0.pkg",

        // Name of the application folder.
        // If left unspecified, will use `{{brewFormulaName}}.app`.
        //  
        "appName": "App.app",

        // URL providing an appcast feed to find updates for this Cask.
        // Default is empty.
        //  
        "appcast": "https://{{repoHost}}/{{repoOwner}}/{{repoName}}/releases.atom",

        // Procedures to uninstall the Cask.
        // 
        "uninstall": {
          "pkgutil": {
            "com.acme.app"
          }
        },

        // Additional procedures for a more complete uninstall.
        // 
        "zap": {
          "trash": {
            "~/Library/Caches/App"
          }
        }
      }
    }
  }
}
<jreleaser>
  <!--
    
  -->
  <packagers>
    <!--
      
    -->
    <brew>
      <!--
        Enables or disables Homebrew.
        Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
        Defaults to `NEVER`.
        
      -->
      <active>ALWAYS</active>

      <!--
        Let the release continue if the packager fails.
        Defaults to `false`.
        
      -->
      <continueOnError>true</continueOnError>

      <!--
        Custom download URL.
         
      -->
      <downloadUrl>https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}</downloadUrl>

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

      <!--
        Directory with file templates used to prepare the Homebrew distribution.
        Defaults to `src/jreleaser/distributions/${distribution.name}/brew`.
        If specified, path must exist.
        
      -->
      <templateDirectory>path/to/brew/templates</templateDirectory>

      <!--
        Git author used to commit to the repository.
        
      -->
      <commitAuthor>

        <!--
           Name used when authoring commits.
          Defaults to `jreleaserbot`.
          
        -->
        <name>jreleaserbot</name>

        <!--
          E-mail used when authoring commits.
          Defaults to `jreleaser@kordamp.org`.
          
        -->
        <email>jreleaser@kordamp.org</email>
      </commitAuthor>

      <!--
        Git repository to push the formula to.
        Defaults are shown.
        
      -->
      <tap>
        <!--
          Enables or disables the tap.
          Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
          Defaults to `RELEASE`.
          
        -->
        <active>ALWAYS</active>


        <!--
          The owner of the tap.
          Defaults to the same owner as the release repository.
          
        -->
        <owner>duke</owner>

        <!--
          The name of the tap.
          Defaults to `homebrew-tap`.
          
        -->
        <name>homebrew-tap</name>

        <!--
          The tag associated with the formula.
          If left unspecified, will use `{{tagName}}`.
           
        -->
        <tagName>{{distributionName}} {{tagName}}</tagName>

        <!--
          The target branch to use.
          May define a `JRELEASER_HOMEBREW_${GIT}_BRANCH`` environment variable instead.
          Defaults to the branch pointed by HEAD.
           
        -->
        <branch>HEAD</branch>

        <!--
          Username used for authoring commits. Must have write access to the tap.
          If left unspecified, the `JRELEASER_HOMEBREW_${GIT}_USERNAME`
          environment variable must be defined.
          Defaults to the same username as the release repository.
           
        -->
        <username>duke</username>

        <!--
          Password or OAuth token with write access to the tap.
          If left unspecified, the `JRELEASER_HOMEBREW_${GIT}_TOKEN`
          environment variable must be defined.
           
        -->
        <token>__DO_NOT_SET_HERE__</token>

        <!--
          Message when committing to the tap.
          If left unspecified, `{{distributionName}} {{tagName}}` will be used.
           
        -->
        <commitMessage>{{distributionName}} {{tagName}}</commitMessage>
      </tap>

      <!--
        The class name of the generated formula.
        If left unspecified, will use `{{projectNameCapitalized}}`.
         
      -->
      <formulaName>App</formulaName>

      <!--
        Create a formula that supports OSX & Linux.
        Applicable to distributions of type [JLINK, NATIVE_IMAGE, BINARY].
        Default is `false`.
        
      -->
      <multiPlatform>false</multiPlatform>

      <!--
        Customize the livecheck block.
        Default is empty.
         
      -->
      <livecheck>
        <livecheck>url "https://host/sparkle/appcast-release.xml"</livecheck>
        <livecheck>strategy :sparkle</livecheck>
      </livecheck>

      <!--
        A map of Homebrew dependencies.
        The key `openjdk@${java.version}` will be added automatically if not defined.
        This can be skipped by adding `skipJava` as an extra property on the distribution.
        
      -->
      <dependencies>
        <!--
          key in symbol format
          mapped as `depends_on :key1 => "value1"`
        -->
        <dependency>
          <key>:key1</key>
          <value>value1</value>
        </dependency>

        <!--
          plain key
          mapped as `depends_on "key2" => "value2"`
        -->
        <dependency>
          <key>key2</key>
          <value>value2</value>
        </dependency>

        <!--
          key in symbol format without value
          mapped as `depends_on :key3`
        -->
        <dependency>
          <key>:key3</key>
        </dependency>

        <!--
          plain key without value
          mapped as `depends_on "key4"`
        -->
        <dependency>
          <key>key4</key>
        </dependency>
      </dependencies>

      <!--
        Cask configuration.
        Requires artifact with extension `.dmg` or `.pkg`.
        Defaults are shown.
        
      -->
      <cask>

        // Favors producing a cask instead of a formula.
        // Default is `false`.
        // 
        <enabled>true</enabled>

        <!--
          The class name of the generated cask.
          If left unspecified, will use `{{projectName}}`.
           
        -->
        <name>app</name>

        <!--
          The name of the generated cask.
          If left unspecified, will use `{{brewFormulaName}}`.
           
        -->
        <displayName>App</displayName>

        <!--
          Relative path to the .pkg file.
          If left unspecified, will use the filename of the .pkg file.
           
        -->
        <pkgName>app-1.0.0.pkg</pkgName>

        <!--
          Name of the application folder.
          If left unspecified, will use `{{brewFormulaName}}.app`.
           
        -->
        <appName>App.app</appName>

        <!--
          URL providing an appcast feed to find updates for this Cask.
          Default is empty.
           
        -->
        <appcast>https://{{repoHost}}/{{repoOwner}}/{{repoName}}/releases.atom</appcast>

        <!--
          Procedures to uninstall the Cask.
          
        -->
        <uninstall>
          <pkgutil>
            <pkgutil>com.acme.app</pkgutil>
          </pkgutil>
        </uninstall>

        <!--
          Additional procedures for a more complete uninstall.
          
        -->
        <zap>
          <trash>
            <trash>~/Library/Caches/App</trash>
          </trash>
        </zap>
       </cask>
    </brew>
  </packagers>
</jreleaser>
jreleaser {
  // 
  packagers {
    // 
    brew {
      // Enables or disables Homebrew.
      // Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      // Defaults to `NEVER`.
      // 
      active = 'ALWAYS'

      // Let the release continue if the packager fails.
      // Defaults to `false`.
      // 
      continueOnError = true

      // Custom download URL.
      //  
      downloadUrl = 'https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}'

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

      // Directory with file templates used to prepare the Homebrew distribution.
      // Defaults to `src/jreleaser/distributions/${distribution.name}/brew`.
      // If specified, path must exist.
      // 
      templateDirectory = 'path/to/brew/templates'

      // Git author used to commit to the repository.
      // 
      commitAuthor {
        // Name used when authoring commits.
        // Defaults to `jreleaserbot`.
        // 
        name = 'jreleaserbot'

        // E-mail used when authoring commits.
        // Defaults to `jreleaser@kordamp.org`.
        // 
        email = 'jreleaser@kordamp.org'
      }

      // Git repository to push the formula to.
      // Defaults are shown.
      // 
      repoTap {
        // Enables or disables the repoTap.
        // Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
        // Defaults to `RELEASE`.
        // 
        active = 'ALWAYS'


        // The owner of the repoTap.
        // Defaults to the same owner as the release repository.
        // 
        owner = 'duke'

        // The name of the repoTap.
        // Defaults to `homebrew-tap`.
        // 
        name = 'homebrew-tap'

        // The tag associated with the formula.
        // If left unspecified, will use `{{tagName}}`.
        //  
        tagName = '{{distributionName}} {{tagName}}'

        // The target branch to use.
        // May define a `JRELEASER_BRANCH` environment variable instead.
        // Defaults to the branch pointed by HEAD.
        //  
        branch = 'HEAD'

        // Username used for authoring commits. Must have write access to the repoTap.
        // If left unspecified, the `JRELEASER_HOMEBREW_${GIT}_USERNAME`
        // environment variable must be defined.
        // Defaults to the same username as the release repository.
        //  
        username = 'duke'

        // Password or OAuth token with write access to the repoTap.
        // If left unspecified, the `JRELEASER_HOMEBREW_${GIT}_TOKEN`
        // environment variable must be defined.
        //  
        token = '__DO_NOT_SET_HERE__'

        # Message when committing to the repoTap.
        # If left unspecified, `{{distributionName}} {{tagName}}` will be used.
        #  
        commitMessage = '{{distributionName}} {{tagName}}'
      }

      // The class name of the generated formula.
      // If left unspecified, will use `{{projectNameCapitalized}}`.
      //  
      formulaName = 'App'

      // Create a formula that supports OSX & Linux.
      // Applicable to distributions of type [JLINK, NATIVE_IMAGE, BINARY].
      // Default is `false`.
      // 
      multiPlatform = false

      // Customize the livecheck block.
      // Default is empty.
      //  
      livecheck = [
        'url "https://host/sparkle/appcast-release.xml"',
        'strategy :sparkle']

      // A map of Homebrew dependencies.
      // The key `openjdk@${java.version}` will be added automatically if not defined.
      // This can be skipped by adding `skipJava` as an extra property on the distribution.
      // 
      dependencies {
        // key in symbol format
        // mapped as `depends_on :key1 => "value1"`
        addDepencency(':key1', 'value1')

        // plain key
        // mapped as `depends_on "key2" => "value2"`
        addDepencency('key2', 'value2')

        // key in symbol format without value
        // mapped as `depends_on :key3`
        addDependency(':key3')

        // plain key without value
        // mapped as `depends_on "key4"`
        addDependency('key4')
      }

      // Cask configuration.
      // Requires artifact with extension `.dmg` or `.pkg`.
      // Defaults are shown.
      // 
      cask {

        // Favors producing a cask instead of a formula.
        // Default is `false`.
        // 
        enabled = true

        // The class name of the generated cask.
        // If left unspecified, will use `{{projectName}}`.
        //  
        name = 'app'

        // The name of the generated cask.
        // If left unspecified, will use `{{brewFormulaName}}`.
        //  
        displayName = 'App'

        // Relative path to the .pkg file.
        // If left unspecified, will use the filename of the .pkg file.
        //  
        pkgName = 'app-1.0.0.pkg'

        // Name of the application folder.
        // If left unspecified, will use `{{brewFormulaName}}.app`.
        //  
        appName = 'App.app'

        // URL providing an appcast feed to find updates for this Cask.
        // Default is empty.
        //  
        appcast = 'https://{{repoHost}}/{{repoOwner}}/{{repoName}}/releases.atom'

        // Procedures to uninstall the Cask.
        // 
        uninstall = [
          pkgutil: [
            'com.acme.app'
          ]
        ]

        // Additional procedures for a more complete uninstall.
        // 
        zap = [
          trash: [
            '~/Library/Caches/App'
          ]
        ]
      }
    }
  }
}
Formula names must be unique!

Tokens

The repoTap token environment variable must match with the chosen Release service that is, it must be one of:
  • JRELEASER_HOMEBREW_GITHUB_TOKEN

  • JRELEASER_HOMEBREW_GITLAB_TOKEN

  • JRELEASER_HOMEBREW_GITEA_TOKEN

  • JRELEASER_HOMEBREW_CODEBERG_TOKEN

If a matching token is not found then the releaser’s token will be used instead:

  • JRELEASER_GITHUB_TOKEN

  • JRELEASER_GITLAB_TOKEN

  • JRELEASER_GITEA_TOKEN

  • JRELEASER_CODEBERG_TOKEN

On GitHub, you can’t use the default secrets.GITHUB_TOKEN as this token only works for the repository that’s running the workflow. You must configure a Personal Access Token instead.

DownloadURL

JReleaser follows these rules to find the download URL to use for a given artifact:

  1. if artifact.extraProperties.brewDownloadUrl exists, use it.

  2. if artifact.extraProperties.downloadUrl exists, use it.

  3. if explicit downloadUrl is set on brew, use it.

  4. if distribution.extraProperties.brewDownloadUrl exists, use it.

  5. if distribution.extraProperties.downloadUrl exists, use it.

  6. if releaser.${git}.skipRelease is false then use the releaser’s downloadUrl.

  7. if releaser.${git}.skipRelease is true then look for a matching uploader given an extraProperty named downloadUrlFrom on artifact, distribution, `brew (in that order). The value must be <uploaderType>:<uploaderName> such as "artifactory:app" or "s3:uploads".

  8. fail if no suitable URL is found.

With no extra configuration from your side rule 6. will be chosen which is the suitable default that most projects need.

Example

Assuming the current version is 1.2.3, and a distribution named app, the above configuration will generate a app.rb formula in the duke/homebrew-tap repository:

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
JReleaser does not generate a valid homebrew-core formula. The generated formulas are meant to be published as homebrew taps, and in their current form will not be accepted in any of the official homebrew repositories.

Skip Artifacts

You may mark artifacts to be skipped for this packager by adding an extra property name skipBrew set to true.

Casks

Casks require a .zip, .dmg or a .pkg artifact. Distributions that provide more than one of these files can mark which artifacts should be skipped from being resolved as a Cask candidate by adding a skipBrew extra property to the target artifacts.

Templates

The default location for templates is:

src/jreleaser/distributions/<distribution-name>/brew

The following list shows the filenames that may be used to override default templates:

  • cask.rb.tpl

  • formula.rb.tpl

  • formula-multi.rb.tpl

  • README.md.tpl

Any additional files found in the template directories will be copied as is unless their filename ends with .tpl in which case Name Templates substitution will take place.

Templates may be initialized using the template command