Artifactory

Uploads artifacts, files, and signatures to an Artifactory instance.

Prerequisites:
  • A running Artifactory instance.

  • A generic repository.

  • A user + password / token with grants to upload an artifact.

This feature does not support deploying JARs and POMs to a Maven repository.

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

# 
upload:
  # 
  artifactory:
    # Uploaders require a name.
    # 
    app:

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

      # Defines the connection timeout in seconds.
      # Defaults to `20`.
      # 
      connectTimeout: 20

      # Defines the read timeout in seconds.
      # Defaults to `60`.
      # 
      readTimeout: 60

      # URL of the Artifactory instance + path.
      # The artifact file name will be appended automatically.
      #  
      target: https://duke.jfrog.io/artifactory/binaries/{{projectName}}/{{projectVersion}}

      # The username that can write to the repository.
      # If left unspecified, the `JRELEASER_ARTIFACTORY_${name}_USERNAME`
      # environment variable must be defined.
      #  
      username: __DO_NOT_SET_HERE__

      # Password for login into the repository.
      # If left unspecified, the `JRELEASER_ARTIFACTORY_${name}_PASSWORD`
      # environment variable must be defined.
      #  
      password: __DO_NOT_SET_HERE__

      # The authorization method to use.
      # Valid values are [`BASIC`, `BEARER`].
      # `Basic` requires both username & password.
      # `BEARER` requires a token (set as password).
      # Defaults to `BEARER`.
      # 
      authorization: BASIC

      # Upload files.
      # Defaults to `true`.
      # 
      files: true

      # Upload distribution artifacts.
      # Defaults to `true`.
      # 
      artifacts: true

      # Upload signatures.
      # Defaults to `true`.
      # 
      signatures: true

      # Additional properties used when evaluating templates.
      # 
      extraProperties:
        # Key will be capitalized and prefixed with `artifactory`, i.e, `artifactoryFoo`.
        foo: bar
# Uploaders require a name.
# 
[upload.artifactory.app]

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

  # Defines the connection timeout in seconds.
  # Defaults to `20`.
  # 
  connectTimeout = 20

  # Defines the read timeout in seconds.
  # Defaults to `60`.
  # 
  readTimeout = 60

  # URL of the Artifactory instance + path.
  # The artifact file name will be appended automatically.
  #  
  target = "https://duke.jfrog.io/artifactory/binaries/{{projectName}}/{{projectVersion}}"

  # The username that can write to the repository.
  # If left unspecified, the `JRELEASER_ARTIFACTORY_${name}_USERNAME`
  # environment variable must be defined.
  #  
  username = "__DO_NOT_SET_HERE__"

  # Password for login into the repository..
  # If left unspecified, the `JRELEASER_ARTIFACTORY_${name}_PASSWORD`
  # environment variable must be defined.
  #  
  password = "__DO_NOT_SET_HERE__"

  # The authorization method to use.
  # Valid values are [`BASIC`, `BEARER`].
  # `Basic` requires both username & password.
  # `BEARER` requires a token (set as password).
  # Defaults to `BEARER`.
  # 
  authorization = "BASIC"

  # Upload files.
  # Defaults to `true`.
  # 
  files = true

  # Upload distribution artifacts.
  # Defaults to `true`.
  # 
  artifacts = true

  # Upload signatures.
  # Defaults to `true`.
  # 
  signatures = true

  # Additional properties used when evaluating templates.
  # 
  extraProperties.foo = "bar"
  # Key will be capitalized and prefixed with `artifactory`, i.e, `artifactoryFoo`.
{
  // 
  "upload": {
    // 
    "artifactory": {
      // Uploaders require a name.
      // 
      "app": {

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

        // Defines the connection timeout in seconds.
        // Defaults to `20`.
        // 
        "connectTimeout": 20,

        // Defines the read timeout in seconds.
        // Defaults to `60`.
        // 
        "readTimeout": 60,

        // URL of the Artifactory instance + path.
        // The artifact file name will be appended automatically.
        //  
        "target": "https://duke.jfrog.io/artifactory/binaries/{{projectName}}/{{projectVersion}}",

        // The username that can write to the repository.
        // If left unspecified, the `JRELEASER_ARTIFACTORY_${name}_USERNAME`
        // environment variable must be defined.
        //  
        "username": "__DO_NOT_SET_HERE__",

        // Password for login into the repository.
        // If left unspecified, the `JRELEASER_ARTIFACTORY_${name}_PASSWORD`
        // environment variable must be defined.
        //  
        "password": "__DO_NOT_SET_HERE__",

        // The authorization method to use.
        // Valid values are [`BASIC`, `BEARER`].
        // `Basic` requires both username & password.
        // `BEARER` requires a token (set as password).
        // Defaults to `BEARER`.
        // 
        "authorization": "BEARER",

        // Upload files.
        // Defaults to `true`.
        // 
        "files": true,

        // Upload distribution artifacts.
        // Defaults to `true`.
        // 
        "artifacts": true,

        // Upload signatures.
        // Defaults to `true`.
        // 
        "signatures": true,

        // Additional properties used when evaluating templates.
        // 
        "extraProperties": {
          // Key will be capitalized and prefixed with `artifactory`, i.e, `artifactoryFoo`.
          "foo": "bar"
        }
      }
    }
  }
}
<jreleaser>
  <!--
    
  -->
  <upload>
    <!--
      
    -->
    <artifactory>
      <!--
        Uploaders require a name.
        
      -->
      <app>
        <!--
          Enables or disables the distribution.
          Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
          Defaults to `ALWAYS`.
          
        -->
        <active>ALWAYS</active>

        <!--
          Defines the connection timeout in seconds.
          Defaults to `20`.
          
        -->
        <connectTimeout>20</connectTimeout>

        <!--
          Defines the read timeout in seconds.
          Defaults to `60`.
          
        -->
        <readTimeout>60</readTimeout>

        <!--
          URL of the Artifactory instance + path.
          The artifact file name will be appended automatically.
           
        -->
        <target>https://duke.jfrog.io/artifactory/binaries/{{projectName}}/{{projectVersion}}</target>

        <!--
          The username that can write to the repository.
          If left unspecified, the `JRELEASER_ARTIFACTORY_${name}_USERNAME`
          environment variable must be defined.
           
        -->
        <username>__DO_NOT_SET_HERE__</username>

        <!--
          Password for login into the repository.
          If left unspecified, the `JRELEASER_ARTIFACTORY_${name}_PASSWORD`
          environment variable must be defined.
           
        -->
        <password>__DO_NOT_SET_HERE__</password>

        <!--
          The authorization method to use.
          Valid values are [`BASIC`, `BEARER`].
          `Basic` requires both username & password.
          `BEARER` requires a token (set as password).
          Defaults to `BEARER`.
          
        -->
        <authorization>BEARER</authorization>

        <!--
          Upload files.
          Defaults to `true`.
          
        -->
        <files>true</files>

        <!--
          Upload distribution artifacts.
          Defaults to `true`.
          
        -->
        <artifacts>true</artifacts>

        <!--
          Upload signatures.
          Defaults to `true`.
          
        -->
        <signatures>true</signatures>

        <!--
          Additional properties used when evaluating templates.
          
        -->
        <extraProperties>
          <!--
            Key will be capitalized and prefixed with `artifactory`, i.e, `artifactoryFoo`.
          -->
          <foo>bar</foo>
        </extraProperties>
      </app>
    </artifactory>
  </upload>
</jreleaser>
jreleaser {
  // 
  upload {
    // 
    artifactory {
      // Uploaders require a name.
      // 
      app {

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

        // Defines the connection timeout in seconds.
        // Defaults to `20`.
        // 
        connectTimeout = 20

        // Defines the read timeout in seconds.
        // Defaults to `60`.
        // 
        readTimeout = 60

        // URL of the Artifactory instance + path.
        // The artifact file name will be appended automatically.
        //  
        target = 'https://duke.jfrog.io/artifactory/binaries/{{projectName}}/{{projectVersion}}'

        // The username that can write to the repository.
        // If left unspecified, the `JRELEASER_ARTIFACTORY_${name}_USERNAME`
        // environment variable must be defined.
        //  
        username = '__DO_NOT_SET_HERE__'

        // Password for login into the repository.
        // If left unspecified, the `JRELEASER_ARTIFACTORY_${name}_PASSWORD`
        // environment variable must be defined.
        //  
        password = '__DO_NOT_SET_HERE__'

        // The authorization method to use.
        // Valid values are [`BASIC`, `BEARER`].
        // `Basic` requires both username & password.
        // `BEARER` requires a token (set as password).
        // Defaults to `BEARER`.
        // 
        authorization = 'BEARER'

        // Upload files.
        // Defaults to `true`.
        // 
        files = true

        // Upload distribution artifacts.
        // Defaults to `true`.
        // 
        artifacts = true

        // Upload signatures.
        // Defaults to `true`.
        // 
        signatures = true

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

Target

The target is the URL to upload the artifacts to (without the name of the artifact).

An example configuration can look like target: 'https://artifacts.company.com:8081/artifactory/example-repo-local/{{projectName}}/{{projectVersion}}'.

And will result in a final deployment like https://artifacts.company.com:8081/artifactory/example-repo-local/app/1.0.0/app-1.0.0.zip.

Username

The configured username needs to be authenticated against the Artifactory instance.

You can have the username set in the configuration as shown above or you can have it read from an environment variable. The configured name of the Artifactory instance will be used to build the environment variable name. This means that the name per configured instance needs to be unique.

The name of the environment variable will be JRELEASER_ARTIFACTORY_NAME_USERNAME. If your instance is named production, you can store the username in the environment variable JRELEASER_ARTIFACTORY_PRODUCTION_USERNAME. The name will be transformed to uppercase.

If a configured username is found in the configuration file, then the environment variable is not used at all.

Password

The password will be stored in an environment variable. The configured name of the Artifactory instance will be used. This means that the name per configured instance needs to be unique.

The name of the environment variable will be JRELEASER_ARTIFACTORY_NAME_PASSWORD. If your instance is named production, you need to store the secret in the environment variable JRELEASER_ARTIFACTORY_PRODUCTION_PASSWORD. The name will be transformed to uppercase.