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 formulae:

  • .jar

  • .zip

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

  • .dmg

  • .pkg

  • .zip

Distribution Support

Distribution Supported

Binary

Flat Binary

Java Binary

Jlink

Native Image

Native Package

Single JAR

Publication of snapshots is not allowed.

Configuration

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

# 
packagers:
  # 
  brew:
    # Enables or disables Homebrew.
    # Supported 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

    # List of template files to be skipped.
    # Value may be an exact match or a regex.
    # 
    skipTemplates:
      - README.md.tpl

    # 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.
    # 
    repository:
      # Enables or disables the repository.
      # Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      # Defaults to `RELEASE`.
      # 
      active: ALWAYS


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

      # The name of the repository.
      # 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 pull from.
      # Defaults to the branch pointed by HEAD.
      #  
      branch: HEAD

      # The target branch to push to.
      # Defaults to the branch pointed by `#{branch}`.
      #   
      branchPush: '{{projectName}}-{{tagName}}'

      # Username used for authoring commits.
      # Must have write access to the repository.
      # Defaults to the same username as the release repository.
      #  
      username: duke

      # Password or OAuth token with write access to the repository.
      #  
      token: __USE_ENVIRONMENT_VARIABLE__

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

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

    # 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`, `BINARY`, `FLAT_BINARY`].
    # Default is `false`.
    # 
    multiPlatform: false

    # Set a custom download strategy. Note that you'll need
    # to implement the strategy and add it to your tap repository.
    # Example: https://docs.brew.sh/Formula-Cookbook#url-download-strategies
    # 
    downloadStrategy: CurlDownloadStrategy

    # Adds `require_relative` statements at the top of the formula template.
    # 
    requireRelative:
      - custom_download_strategy

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

    # A map of Homebrew dependencies.
    # A dependency to `openjdk` is automatically added to applicable Java distributions.
    # 
    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.
  # Supported 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"

  # List of template files to be skipped.
  # Value may be an exact match or a regex.
  # 
  skipTemplates = [ "README.md.tpl" ]

  # 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 repository.
  # Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
  # Defaults to `RELEASE`.
  # 
  repository.active = "ALWAYS"


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

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

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

  # The target branch to pull from.
  # Defaults to the branch pointed by HEAD.
  #  
  repository.branch = "HEAD"

  # The target branch to push to.
  # Defaults to the branch pointed by `#{branch}`.
  #    
  repository.branchPush = "{{projectName}}-{{tagName}}"

  # Username used for authoring commits.
  # Must have write access to the repository.
  # Defaults to the same username as the release repository.
  #  
  repository.username = "duke"

  # Password or OAuth token with write access to the repository.
  #  
  repository.token = "__USE_ENVIRONMENT_VARIABLE__"

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

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

  # 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`, `BINARY`, `FLAT_BIINARY`].
  # Default is `false`.
  # 
  multiPlatform = false

  # Set a custom download strategy. Note that you'll need
  # to implement the strategy and add it to your tap repository.
  # Example: https://docs.brew.sh/Formula-Cookbook#url-download-strategies
  # 
  downloadStrategy = "CurlDownloadStrategy"

  # Adds `require_relative` statements at the top of the formula template.
  # 
  requireRelative = ["custom_download_strategy"]

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

  # A map of Homebrew dependencies.
  # A dependency to `openjdk` is automatically added to applicable Java distributions.
  # 
  # 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.
      // Supported 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",

      // List of template files to be skipped.
      // Value may be an exact match or a regex.
      // 
      "skipTemplates": [
        "README.md.tpl"
      ],

      // 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.
      // 
      "repository": {
        // Enables or disables the repository.
        // Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
        // Defaults to `RELEASE`.
        // 
        "active": "ALWAYS",


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

        // The name of the repository.
        // 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 pull from.
        // Defaults to the branch pointed by HEAD.
        //  
        "branch": "HEAD",

        // The target branch to push to.
        // Defaults to the branch pointed by `#{branch}`.
        //   
        "branchPush": "{{projectName}}-{{tagName}}",

        // Username used for authoring commits.
        // Must have write access to the repository.
        // Defaults to the same username as the release repository.
        //  
        "username": "duke",

        // Password or OAuth token with write access to the repository.
        //  
        "token": "__USE_ENVIRONMENT_VARIABLE__",

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

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

      // 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`, `BINARY`, `FLAT_BIINARY`].
      // Default is `false`.
      // 
      "multiPlatform": false,

      // Set a custom download strategy. Note that you'll need
      // to implement the strategy and add it to your tap repository.
      // Example: https://docs.brew.sh/Formula-Cookbook#url-download-strategies
      // 
      "downloadStrategy": "CurlDownloadStrategy",

      // Adds `require_relative` statements at the top of the formula template.
      // 
      "requireRelative": [
        "custom_download_strategy"
      ],

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

      // A map of Homebrew dependencies.
      // A dependency to `openjdk` is automatically added to applicable Java distributions.
      // 
      "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.
        Supported 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>

      <!--
        List of template files to be skipped.
        Value may be an exact match or a regex.
        
      -->
      <skipTemplates>
        <skipTemplate>README.md.tpl</skipTemplate>
      </skipTemplates>

      <!--
        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.
        
      -->
      <repository>
        <!--
          Enables or disables the repository.
          Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
          Defaults to `RELEASE`.
          
        -->
        <active>ALWAYS</active>


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

        <!--
          The name of the repository.
          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 pull from.
          Defaults to the branch pointed by HEAD.
           
        -->
        <branch>HEAD</branch>

        <!--
          The target branch to push to.
          Defaults to the branch pointed by `#{branch}`.
            
        -->
        <branchPush>{{projectName}}-{{tagName}}</branchPush>

        <!--
          Username used for authoring commits.
          Must have write access to the repository.
          Defaults to the same username as the release repository.
           
        -->
        <username>duke</username>

        <!--
          Password or OAuth token with write access to the repository.
           
        -->
        <token>__USE_ENVIRONMENT_VARIABLE__</token>

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

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

      <!--
        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`, `BINARY`, `FLAT_BIINARY`].
        Default is `false`.
        
      -->
      <multiPlatform>false</multiPlatform>

      <!--
        Set a custom download strategy. Note that you'll need
        to implement the strategy and add it to your tap repository.
        Example: https://docs.brew.sh/Formula-Cookbook#url-download-strategies
        
      -->
      <downloadStrategy>CurlDownloadStrategy</downloadStrategy>

      <!--
        Adds `require_relative` statements at the top of the formula template.
        
      -->
      <requireRelative>
        <require>custom_download_strategy</require>
      </requireRelative>

      <!--
        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.
        A dependency to `openjdk` is automatically added to applicable Java distributions.
        
      -->
      <dependencies>
        <!--
          key in symbol format
          mapped as `depends_on :key1 => "value1"`
        -->
        <:key1>value1</:key1>

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

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

        <!--
          plain key without value
          mapped as `depends_on "key4"`
        -->
        <key4/>
      </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.
      // Supported 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'

      // List of template files to be skipped.
      // Value may be an exact match or a regex.
      // 
      skipTemplate('README.md.tpl')

      // 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.
      // 
      repository {
        // Enables or disables the repository.
        // Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
        // Defaults to `RELEASE`.
        // 
        active = 'ALWAYS'


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

        // The name of the repository.
        // 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 pull from.
        // Defaults to the branch pointed by HEAD.
        //  
        branch = 'HEAD'

        // The target branch to push to.
        // Defaults to the branch pointed by `#{branch}`.
        //   
        branchPush = '{{projectName}}-{{tagName}}'

        // Username used for authoring commits.
        // Must have write access to the repository.
        // Defaults to the same username as the release repository.
        //  
        username = 'duke'

        // Password or OAuth token with write access to the repository.
        //  
        token = '__USE_ENVIRONMENT_VARIABLE__'

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

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

      // 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`, `BINARY`, `FLAT_BIINARY`].
      // Default is `false`.
      // 
      multiPlatform = false

      // Set a custom download strategy. Note that you'll need
      // to implement the strategy and add it to your tap repository.
      // Example: https://docs.brew.sh/Formula-Cookbook#url-download-strategies
      // 
      downloadStrategy = 'CurlDownloadStrategy'

      // Adds `require_relative` statements at the top of the formula template.
      // 
      requireRelative = ['custom_download_strategy']

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

      // A map of Homebrew dependencies.
      // A dependency to `openjdk` is automatically added to applicable Java distributions.
      // 
      dependencies {
        // key in symbol format
        // mapped as `depends_on :key1 => "value1"`
        dependency(':key1', 'value1')

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

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

        // plain key without value
        // mapped as `depends_on "key4"`
        dependency('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!

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.

Inside packagers section

System Property Environment Variable

active

jreleaser.packagers.brew.active

JRELEASER_PACKAGERS_BREW_ACTIVE

Inside distributions section

System Property Environment Variable

active

jreleaser.distributions.${name}.brew.active

JRELEASER_DISTRIBUTIONS_${name}_BREW_ACTIVE

repository.active

jreleaser.distributions.${name}.brew.repository.active

JRELEASER_DISTRIBUTIONS_${name}_BREW_REPOSITORY_ACTIVE

repository.username

jreleaser.distributions.${name}.brew.repository.username
jreleaser.homebrew.github.username
jreleaser.homebrew.gitlab.username
jreleaser.homebrew.gitea.username
jreleaser.homebrew.codeberg.username
jreleaser.github.username
jreleaser.gitlab.username
jreleaser.gitea.username
jreleaser.codeberg.username

JRELEASER_DISTRIBUTIONS_${name}_BREW_REPOSITORY_USERNAME
JRELEASER_HOMEBREW_GITHUB_USERNAME
JRELEASER_HOMEBREW_GITLAB_USERNAME
JRELEASER_HOMEBREW_GITEA_USERNAME
JRELEASER_HOMEBREW_CODEBERG_USERNAME
JRELEASER_GITHUB_USERNAME
JRELEASER_GITLAB_USERNAME
JRELEASER_GITEA_USERNAME
JRELEASER_CODEBERG_USERNAME

repository.token

jreleaser.distributions.${name}.brew.repository.token
jreleaser.homebrew.github.token
jreleaser.homebrew.gitlab.token
jreleaser.homebrew.gitea.token
jreleaser.homebrew.codeberg.token
jreleaser.github.token
jreleaser.gitlab.token
jreleaser.gitea.token
jreleaser.codeberg.token

JRELEASER_DISTRIBUTIONS_${name}_BREW_REPOSITORY_TOKEN
JRELEASER_HOMEBREW_GITHUB_TOKEN
JRELEASER_HOMEBREW_GITLAB_TOKEN
JRELEASER_HOMEBREW_GITEA_TOKEN
JRELEASER_HOMEBREW_CODEBERG_TOKEN
JRELEASER_GITHUB_TOKEN
JRELEASER_GITLAB_TOKEN
JRELEASER_GITEA_TOKEN
JRELEASER_CODEBERG_TOKEN

repository.branch

jreleaser.distributions.${name}.brew.repository.branch
jreleaser.homebrew.github.branch
jreleaser.homebrew.gitlab.branch
jreleaser.homebrew.gitea.branch
jreleaser.homebrew.codeberg.branch
jreleaser.github.branch
jreleaser.gitlab.branch
jreleaser.gitea.branch
jreleaser.codeberg.branch

JRELEASER_DISTRIBUTIONS_${name}_BREW_REPOSITORY_BRANCH
JRELEASER_HOMEBREW_GITHUB_BRANCH
JRELEASER_HOMEBREW_GITLAB_BRANCH
JRELEASER_HOMEBREW_GITEA_BRANCH
JRELEASER_HOMEBREW_CODEBERG_BRANCH
JRELEASER_GITHUB_BRANCH
JRELEASER_GITLAB_BRANCH
JRELEASER_GITEA_BRANCH
JRELEASER_CODEBERG_BRANCH

repository.branchPush

jreleaser.distributions.${name}.brew.repository.branch.push
jreleaser.homebrew.github.branch.push
jreleaser.homebrew.gitlab.branch.push
jreleaser.homebrew.gitea.branch.push
jreleaser.homebrew.codeberg.branch.push
jreleaser.github.branch.push
jreleaser.gitlab.branch.push
jreleaser.gitea.branch.push
jreleaser.codeberg.branch.push

JRELEASER_DISTRIBUTIONS_${name}_BREW_REPOSITORY_BRANCH_PUSH
JRELEASER_HOMEBREW_GITHUB_BRANCH_PUSH
JRELEASER_HOMEBREW_GITLAB_BRANCH_PUSH
JRELEASER_HOMEBREW_GITEA_BRANCH_PUSH
JRELEASER_HOMEBREW_CODEBERG_BRANCH_PUSH
JRELEASER_GITHUB_BRANCH_PUSH
JRELEASER_GITLAB_BRANCH_PUSH
JRELEASER_GITEA_BRANCH_PUSH
JRELEASER_CODEBERG_BRANCH_PUSH

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

Tokens

The repository token environment variable must match with the chosen Release service.

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 (PAT) instead. It is recommended that you use "fine-grained" PATs, rather than "classic" ones. The token must have:

  • Access to your tap repository; if this repository is part of a GitHub organization, make sure to choose that organization as the resource owner; if that organization doesn’t show up in the "resource owner" drop-down, contact your organization adminstrator and ask them to enable PAT access for that repository

  • The "Contents read and write" repository permission

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.${release}.skipRelease is false then use the releaser’s downloadUrl.

  7. if releaser.${release}.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.

JDK dependency

For Java Binary and Single JAR distributions, a dependency to OpenJDK is added automatically. This can be disabled entirely by adding skipJava as an extra property on the distribution.

As of JReleaser 1.x, the default is to add a dependency on the specific major JDK version known for the distribution (such as 8 or 17). Later major versions of JReleaser are expected to change this and default to adding a dependency to openjdk without a specific version, as is the usual pattern for Java software on Homebrew. You can explicitly control this by setting the useVersionedJava extra property on the distribution.

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.

The value of the displayName property will be automatically transformed to remove hyphens and have capitalization. If this transformation were to produce the wrong result for you then you may either:

  • set a extraProperty named skipCaskDisplayNameTransform to true.

  • set an explicit value for displayName.

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

Skip Templates

You may skip any template files by defining a set of skip rules in the skipTemplates property. For example, you may use any of these expressions to skip a template named README.md.tpl:

  • README.md.tpl: matches the full template name

  • README.md: matches the transformed template name

  • README.*: matches using a regex

Skip Artifacts

If there is more than one matching artifact in a given distribution you may add a skipBrew extra property to the target artifact to mark it as skipped for packaging with brew.

Skip License

If there’s a matching LICENSE file available at the root of the project it will be copied to the repository by default. You may set an extra property named skipLicenseFile on brew to skip this behavior.

Repository

The repository section allows setting extra properties that may be used to provide additional hints when interacting with the git repository that holds packager files.

GitLab

Define a projectIdentifier property to directly locate the project associated with the repository, such as

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

packagers:
  brew:
    repository:
      extraProperties:
        projectIdentifier: 12345678
[packagers.brew]
  repository.extraProperties.projectIdentifier = "12345678"
{
  "packagers": {
    "brew": {
      "repository": {
        "extraProperties": {
          "projectIdentifier": "12345678"
        }
      }
    }
  }
}
<jreleaser>
  <packagers>
    <brew>
      <repository>
        <extraProperties>
          <projectIdentifier>12345678</projectIdentifier>
        </extraProperties>
      </repository>
    </brew>
  </packagers>
</jreleaser>
jreleaser {
  packagers {
    brew {
      repository {
        extraProperties.put("projectIdentifier", "12345678")
      }
    }
  }
}