Nexus2

Deploys staged artifacts to Sonatype Nexus2 Repository Manager instance.

You may use this deployer to publish releases to Maven Central.
This feature does not support deploying artifacts other than JARs and POMs to a Maven compatible repository.

Configuration

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

# 
deploy:
  maven:
    # 
    pomchecker:
      # Defines the tool version to use.
      # 
      version: 1.9.0

      # Fail the release if pomchecker outputs a warning.
      # Defaults to `true`.
      # 
      failOnWarning: false

      # Fail the release if pomchecker outputs an error.
      # Defaults to `true`.
      # 
      failOnError: false

    # 
    nexus2:
      # Deployers require a name.
      # 
      app:

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

        # URL where the Nexus2 service is enabled.
        # If left unspecified, the `JRELEASER_NEXUS2_${name}_URL`
        # environment variable must be defined.
        #  
        url: https://s01.oss.sonatype.org/service/local

        # The username required for authorization.
        # If left unspecified, the `JRELEASER_NEXUS2_${name}_USERNAME`
        # environment variable must be defined.
        #  
        username: __USE_ENVIRONMENT_VARIABLE__

        # Password for login into the NEXUS2 service.
        # If left unspecified, the `JRELEASER_NEXUS2_${name}_PASSWORD`
        # environment variable must be defined.
        #  
        password: __USE_ENVIRONMENT_VARIABLE__

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

        # Signs artifacts with the configured credentials.
        # The Signing section must be configured as well.
        # Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
        # 
        sign: false

        # Checksums all artifacts with `MD5`, `SHA-1`, `SHA-256`, and `SHA-512`.
        # Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
        # 
        checksums: false

        # Verifies that a matching `-sources.jar` artifact is staged.
        # Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
        # 
        sourceJar: false

        # Verifies that a matching `-javadoc.jar` artifact is staged.
        # Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
        # 
        javadocJar: false

        # Verifies that POM files comply with the minimum requirements for publication
        # to Maven Central. Checks fules using PomChecker.
        # Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
        # 
        verifyPom: false

        # Verifies pom files, signs all artifacts, verifies that matching `-sources.jar` and
        # `-javadoc.jar` artifacts are also staged.
        # Defaults to `false`.
        # 
        applyMavenCentralRules: false

        # Override artifact configuration
        # 
        artifactOverrides:
            # Match artifact by groupId
            # If undefined, will use `#{project.java.groupId}`.
            # 
          - groupId: com.acme

            # Match artifact by artifactId
            # 
            artifactId: app

            # Verifies that a matching `-sources.jar` artifact is staged.
            # Defaults to `false`.
            # 
            sourceJar: false

            # Verifies that a matching `-javadoc.jar` artifact is staged.
            # Defaults to `false`.
            # 
            javadocJar: false

        # List of directories where staged artifacts can be found.
        # 
        stagingRepositories:
          - target/staging-deploy

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

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

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

        # URL where the Nexus2 snapshots are enabled.
        #  
        snapshotUrl: https://s01.oss.sonatype.org/content/repositories/snapshots/

        # Closes the staging repository.
        # Defaults to `false`.
        # 
        closeRepository: true

        # Releases the staging repository.
        # Defaults to `false`.
        # 
        releaseRepository: true

        # Time to wait between state transition checks, in seconds.
        # Defaults to `10`.
        # 
        transitionDelay: 10

        # Maximum number of attempts to verify state transition.
        # Defaults to `60`.
        # 
        transitionMaxRetries: 60
[deploy.maven]
  # Defines the tool version to use.
  # 
  pomchecker.version = "1.9.0"

  # Fail the release if pomchecker outputs a warning.
  # Defaults to `true`.
  # 
  pomchecker.failOnWarning = false

  # Fail the release if pomchecker outputs an error.
  # Defaults to `true`.
  # 
  pomchecker.failOnError = false

# Deployers require a name.
# 
[deploy.maven.nexus2.app]

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

  # URL where the Nexus2 service is enabled.
  #  
  url = "https://s01.oss.sonatype.org/service/local"

  # The username required for authorization.
  #  
  username = "__USE_ENVIRONMENT_VARIABLE__"

  # Password for login into the NEXUS2 service.
  #  
  password = "__USE_ENVIRONMENT_VARIABLE__"

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

  # Signs artifacts with the configured credentials.
  # The Signing section must be configured as well.
  # Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
  # 
  sign = false

  # Checksums all artifacts with `MD5`, `SHA-1`, `SHA-256`, and `SHA-512`.
  # Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
  # 
  checksums = false

  # Verifies that a matching `-sources.jar` artifact is staged.
  # Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
  # 
  sourceJar = false

  # Verifies that a matching `-javadoc.jar` artifact is staged.
  # Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
  # 
  javadocJar = false

  # Verifies that POM files comply with the minimum requirements for publication
  # to Maven Central. Checks fules using PomChecker.
  # Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
  # 
  verifyPom = false

  # Verifies pom files, signs all artifacts, verifies that matching `-sources.jar` and
  # `-javadoc.jar` artifacts are also staged.
  # Defaults to `false`.
  # 
  applyMavenCentralRules = false

  # Override artifact configuration
  # 
  [[deploy.maven.nexus2.app.artifactOverrides]]

    # Match artifact by groupId
    # If undefined, will use `#{project.java.groupId}`.
    # 
    groupId = "com.acme"

    # Match artifact by artifactId
    # 
    artifactId = "app"

    # Verifies that a matching `-sources.jar` artifact is staged.
    # Defaults to `false`.
    # 
    sourceJar = false

    # Verifies that a matching `-javadoc.jar` artifact is staged.
    # Defaults to `false`.
    # 
    javadocJar = false

  # List of directories where staged artifacts can be found.
  # 
  stagingRepositories = ["target/staging-deploy"]

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

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

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

 # URL where the Nexus2 snapshots are enabled.
 #  
 snapshotUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"

  # Closes the staging repository.
  # Defaults to `false`.
  # 
  closeRepository = true

  # Releases the staging repository.
  # Defaults to `false`.
  # 
  releaseRepository = true

  # Time to wait between state transition checks, in seconds.
  # Defaults to `10`.
  # 
  transitionDelay = 10

  # Maximum number of attempts to verify state transition.
  # Defaults to `60`.
  # 
  transitionMaxRetries = 60
{
  // 
  "deploy": {
    "maven": {
      // 
      "pomchecker": {
        // Defines the tool version to use.
        // 
        "version": "1.9.0",

        // Fail the release if pomchecker outputs a warning.
        // Defaults to `true`.
        // 
        "failOnWarning": false,

        // Fail the release if pomchecker outputs an error.
        // Defaults to `true`.
        // 
        "failOnError": false
      },

      // 
      "nexus2": {
        // Deployers require a name.
        // 
        "app": {

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

          // URL where the Nexus2 service is enabled.
          //  
          "url": "https://s01.oss.sonatype.org/service/local",

          // The username required for authorization.
          //  
          "username": "__USE_ENVIRONMENT_VARIABLE__",

          // Password for login into the NEXUS2 service.
          //  
          "password": "__USE_ENVIRONMENT_VARIABLE__",

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

          // Signs artifacts with the configured credentials.
          // The Signing section must be configured as well.
          // Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
          // 
          "sign": false,

          // Checksums all artifacts with `MD5`, `SHA-1`, `SHA-256`, and `SHA-512`.
          // Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
          // 
          "checksums": false,

          // Verifies that a matching `-sources.jar` artifact is staged.
          // Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
          // 
          "sourceJar": false,

          // Verifies that a matching `-javadoc.jar` artifact is staged.
          // Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
          // 
          "javadocJar": false,

          // Verifies that POM files comply with the minimum requirements for publication
          // to Maven Central. Checks fules using PomChecker.
          // Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
          // 
          "verifyPom": false,

          // Verifies pom files, signs all artifacts, verifies that matching `-sources.jar` and
          // `-javadoc.jar` artifacts are also staged.
          // Defaults to `false`.
          // 
          "applyMavenCentralRules": false,

          // Override artifact configuration
          // 
          "artifactOverrides": [
            {
              // Match artifact by groupId
              // If undefined, will use `#{project.java.groupId}`.
              // 
              "groupId": "com.acme",

              // Match artifact by artifactId
              // 
              "artifactId": "app",

              // Verifies that a matching `-sources.jar` artifact is staged.
              // Defaults to `false`.
              // 
              "sourceJar": false,

              // Verifies that a matching `-javadoc.jar` artifact is staged.
              // Defaults to `false`.
              // 
              "javadocJar": false
            }
          ]

          // List of directories where staged artifacts can be found.
          // 
          "stagingRepositories": [
            "target/staging-deploy"
          ],

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

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

          // URL where the Nexus2 snapshots are enabled.
          //  
          "snapshotUrl": "https://s01.oss.sonatype.org/content/repositories/snapshots/",

          // Closes the staging repository.
          // Defaults to `false`.
          // 
          "closeRepository": true,

          // Releases the staging repository.
          // Defaults to `false`.
          // 
          "releaseRepository": true,

          // Time to wait between state transition checks, in seconds.
          // Defaults to `10`.
          // 
          "transitionDelay": 10,

          // Maximum number of attempts to verify state transition.
          // Defaults to `60`.
          // 
          "transitionMaxRetries": 60,
          // Additional properties used when evaluating templates.
          // 
          "extraProperties": {
            // Key will be capitalized and prefixed with `nexus2`, i.e, `nexus2Foo`.
            "foo": "bar"
          }
        }
      }
    }
  }
}
<jreleaser>
  <!--
    
  -->
  <deploy>
    <maven>
      <!--
        
      -->
      <pomchecker>
        <!--
          Defines the tool version to use.
          
        -->
        <version>1.9.0</version>

        <!--
          Fail the release if pomchecker outputs a warning.
          Defaults to `true`.
          
        -->
        <failOnWarning>false</failOnWarning>

        <!--
          Fail the release if pomchecker outputs an error.
          Defaults to `true`.
          
        -->
        <failOnError>false</failOnError>
      </pomchecker>
      <!--
        
      -->
      <nexus2>
        <!--
          Deployers require a name.
          
        -->
        <app>
          <!--
            Enables or disables the deployer.
            Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
            Defaults to `NEVER`.
             
          -->
          <active>ALWAYS</active>

          <!--
            URL where the Nexus2 service is enabled.
             
          -->
          <url>https://s01.oss.sonatype.org/service/local</url>

          <!--
            The username required for authorization.
             
          -->
          <username>__USE_ENVIRONMENT_VARIABLE__</username>

          <!--
            Password for login into the NEXUS2 service.
             
          -->
          <password>__USE_ENVIRONMENT_VARIABLE__</password>

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

          <!--
            Signs artifacts with the configured credentials.
            The Signing section must be configured as well.
            Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
            
          -->
          <sign>false</sign>

          <!--
            Checksums all artifacts with `MD5`, `SHA-1`, `SHA-256`, and `SHA-512`.
            Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
            
          -->
          <checksums>false</checksums>

          <!--
            Verifies that a matching `-sources.jar` artifact is staged.
            Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
            
          -->
          <sourceJar>false</sourceJar>

          <!--
            Verifies that a matching `-javadoc.jar` artifact is staged.
            Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
            
          -->
          <javadocJar>false</javadocJar>

          <!--
            Verifies that POM files comply with the minimum requirements for publication
            to Maven Central. Checks fules using PomChecker.
            Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
            
          -->
          <verifyPom>false</verifyPom>

          <!--
            Verifies pom files, signs all artifacts, verifies that matching `-sources.jar` and
            `-javadoc.jar` artifacts are also staged.
            Defaults to `false`.
            
          -->
          <applyMavenCentralRules>false</applyMavenCentralRules>

          <!--
            Override artifact configuration
            
          -->
          <artifactOverrides>
            <artifactOverride>
              <!--
                Match artifact by groupId
                If undefined, will use `#{project.java.groupId}`.
                
              -->
              <groupId>com.acme</groupId>

              <!--
                Match artifact by artifactId
                
              -->
              <artifactId>app</artifactId>

              <!--
                Verifies that a matching `-sources.jar` artifact is staged.
                Defaults to `false`.
                
              -->
              <sourceJar>false</sourceJar>

              <!--
                Verifies that a matching `-javadoc.jar` artifact is staged.
                Defaults to `false`.
                
              -->
              <javadocJar>false</javadocJar>
            </artifactOverride>
          </artifactOverrides>

          <!--
            List of directories where staged artifacts can be found.
            
          -->
          <stagingRepositories>
            <stagingRepository>target/staging-deploy</stagingRepository>
          </stagingRepositories>

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

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

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

          <!--
            URL where the Nexus2 snapshots are enabled.
             
          -->
          <snapshotUrl>https://s01.oss.sonatype.org/content/repositories/snapshots/</snapshotUrl>

          <!--
            Closes the staging repository.
            Defaults to `false`.
            
          -->
          <closeRepository>true</closeRepository>

          <!--
            Releases the staging repository.
            Defaults to `false`.
            
          -->
          <releaseRepository>true</releaseRepository>

          <!--
            Time to wait between state transition checks, in seconds.
            Defaults to `10`.
            
          -->
          <transitionDelay>10</transitionDelay>

          <!--
            Maximum number of attempts to verify state transition.
            Defaults to `60`.
            
          -->
          <transitionMaxRetries>60</transitionMaxRetries>
        </app>
      </nexus2>
    </maven>
  </deploy>
</jreleaser>
jreleaser {
  // 
  deploy {
    maven {
      // 
      pomchecker {
        // Defines the tool version to use.
        // 
        version = '1.9.0'

        // Fail the release if pomchecker outputs a warning.
        // Defaults to `true`.
        // 
        failOnWarning = false

        // Fail the release if pomchecker outputs an error.
        // Defaults to `true`.
        // 
        failOnError = false
      }

      // 
      nexus2 {
        // Deployers require a name.
        // 
        app {

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

          // URL where the Nexus2 service is enabled.
          //  
          url = 'https://s01.oss.sonatype.org/service/local'

          // The username required for authorization.
          //  
          username = '__USE_ENVIRONMENT_VARIABLE__'

          // Password for login into the NEXUS2 service.
          //  
          password = '__USE_ENVIRONMENT_VARIABLE__'

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

          // Signs artifacts with the configured credentials.
          // The Signing section must be configured as well.
          // Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
          // 
          sign = false

          // Checksums all artifacts with `MD5`, `SHA-1`, `SHA-256`, and `SHA-512`.
          // Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
          // 
          checksums = false

          // Verifies that a matching `-sources.jar` artifact is staged.
          // Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
          // 
          sourceJar = false

          // Verifies that a matching `-javadoc.jar` artifact is staged.
          // Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
          // 
          javadocJar = false

          // Verifies that POM files comply with the minimum requirements for publication
          // to Maven Central. Checks fules using PomChecker.
          // Defaults to `false` unless `applyMavenCentralRules` is set to `true`.
          // 
          verifyPom = false

          // Verifies pom files, signs all artifacts, verifies that matching `-sources.jar` and
          // `-javadoc.jar` artifacts are also staged.
          // Defaults to `false`.
          // 
          applyMavenCentralRules = false

          // Override artifact configuration
          // 
          artifactOverride {
            // Match artifact by groupId
            // If undefined, will use `#{project.java.groupId}`.
            // 
            groupId = 'com.acme'

            // Match artifact by artifactId
            // 
            artifactId = 'app'

            // Verifies that a matching `-sources.jar` artifact is staged.
            // Defaults to `false`.
            // 
            sourceJar = false

            // Verifies that a matching `-javadoc.jar` artifact is staged.
            // Defaults to `false`.
            // 
            javadocJar = false
          }

          // List of directories where staged artifacts can be found.
          // 
          stagingRepository('target/staging-deploy')

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

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

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

          // URL where the Nexus2 snapshots are enabled.
          //  
          snapshotUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'

          // Closes the staging repository.
          // Defaults to `false`.
          // 
          closeRepository = true

          // Releases the staging repository.
          // Defaults to `false`.
          // 
          releaseRepository = true

          // Time to wait between state transition checks, in seconds.
          // Defaults to `10`.
          // 
          transitionDelay = 10

          // Maximum number of attempts to verify state transition.
          // Defaults to `60`.
          // 
          transitionMaxRetries = 60
        }
      }
    }
  }
}

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.

System Property Environment Variable

active

jreleaser.deploy.maven.nexus2.${name}.active
jreleaser.deploy.maven.nexus2.active

JRELEASER_DEPLOY_MAVEN_NEXUS2_${name}_ACTIVE
JRELEASER_DEPLOY_MAVEN_NEXUS2_ACTIVE

url

jreleaser.deploy.maven.nexus2.${name}.url
jreleaser.deploy.maven.nexus2.url
jreleaser.nexus2.${name}.url
jreleaser.nexus2.url

JRELEASER_DEPLOY_MAVEN_NEXUS2_${name}_URL
JRELEASER_DEPLOY_MAVEN_NEXUS2_URL
JRELEASER_NEXUS2_${name}_URL
JRELEASER_NEXUS2_URL

username

jreleaser.deploy.maven.nexus2.${name}.username
jreleaser.deploy.maven.nexus2.username
jreleaser.nexus2.${name}.username
jreleaser.nexus2.username

JRELEASER_DEPLOY_MAVEN_NEXUS2_${name}_USERNAME
JRELEASER_DEPLOY_MAVEN_NEXUS2_USERNAME
JRELEASER_NEXUS2_${name}_USERNAME
JRELEASER_NEXUS2_USERNAME

password

jreleaser.deploy.maven.nexus2.${name}.password
jreleaser.deploy.maven.nexus2.${name}.token
jreleaser.deploy.maven.nexus2.password
jreleaser.deploy.maven.nexus2.token
jreleaser.nexus2.${name}.password
jreleaser.nexus2.${name}.token
jreleaser.nexus2.password
jreleaser.nexus2.token

JRELEASER_DEPLOY_MAVEN_NEXUS2_${name}_PASSWORD
JRELEASER_DEPLOY_MAVEN_NEXUS2_${name}_TOKEN
JRELEASER_DEPLOY_MAVEN_NEXUS2_PASSWORD
JRELEASER_DEPLOY_MAVEN_NEXUS2_TOKEN
JRELEASER_NEXUS2_${name}_PASSWORD
JRELEASER_NEXUS2_${name}_TOKEN
JRELEASER_NEXUS2_PASSWORD
JRELEASER_NEXUS2_TOKEN

snapshotUrl

jreleaser.deploy.maven.nexus2.${name}.snapshot.url
jreleaser.deploy.maven.nexus2.snapshot.url
jreleaser.nexus2.${name}.snapshot.url
jreleaser.nexus2.snapshot.url

JRELEASER_DEPLOY_MAVEN_NEXUS2_${name}_SNAPSHOT_URL
JRELEASER_DEPLOY_MAVEN_NEXUS2_SNAPSHOT_URL
JRELEASER_NEXUS2_${name}_SNAPSHOT_URL
JRELEASER_NEXUS2_SNAPSHOT_URL

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

Example

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

deploy:
  maven:
    nexus2:
      app:
        active: ALWAYS
        url: https://s01.oss.sonatype.org/service/local
        closeRepository: true
        releaseRepository: true
        stagingRepositories:
          - target/staging-deploy
[deploy.maven.nexus2.app]
  active = "ALWAYS"
  url = "https://s01.oss.sonatype.org/service/local"
  closeRepository = true
  releaseRepository = true
  stagingRepositories = ["target/staging-deploy"]
{
  "jreleaser": {
    "deploy": {
      "maven": {
        "nexus2": {
          "app": {
            "active": "ALWAYS",
            "url": "https://s01.oss.sonatype.org/service/local",
            "closeRepository": true,
            "releaseRepository": true,
            "stagingRepositories": [
              "target/staging-deploy"
            ]
          }
        }
      }
    }
  }
}
<jreleaser>
  <deploy>
    <maven>
      <nexus2>
        <app>
          <active>ALWAYS</active>
          <url>https://s01.oss.sonatype.org/service/local</url>
          <closeRepository>true</closeRepository>
          <releaseRepository>true</releaseRepository>
          <stagingRepositories>target/staging-deploy</stagingRepositories>
        </app>
      </nexus2>
    </maven>
  </deploy>
</jreleaser>
jreleaser {
  deploy {
    maven {
      nexus2 {
        app {
          active = 'ALWAYS'
          url = 'https://s01.oss.sonatype.org/service/local'
          closeRepository = true
          releaseRepository = true
          stagingRepository('target/staging-deploy')
        }
      }
    }
  }
}

Any of the following environment variables may be defined to supply values for username and password:

  • JRELEASER_DEPLOY_MAVEN_NEXUS2_APP_USERNAME

  • JRELEASER_DEPLOY_MAVEN_NEXUS2_USERNAME

  • JRELEASER_NEXUS2_APP_USERNAME

  • JRELEASER_NEXUS2_USERNAME

  • JRELEASER_DEPLOY_MAVEN_NEXUS2_APP_PASSWORD

  • JRELEASER_DEPLOY_MAVEN_NEXUS2_APP_TOKEN

  • JRELEASER_DEPLOY_MAVEN_NEXUS2_PASSWORD

  • JRELEASER_DEPLOY_MAVEN_NEXUS2_TOKEN

  • JRELEASER_NEXUS2_APP_PASSWORD

  • JRELEASER_NEXUS2_APP_TOKEN

  • JRELEASER_NEXUS2_PASSWORD

  • JRELEASER_NEXUS2_TOKEN

Staged Deployments

The Nexus2 Maven deployer allows executing deployments in stages that is, you may UPLOAD, CLOSE, and/or RELEASE. You may define any of the following system properties or environment variables to set the given stage:

System Property Environment Variable

start

jreleaser.deploy.maven.nexus2.${name}.start.stage
jreleaser.deploy.maven.nexus2.start.stage
jreleaser.nexus2.${name}.start.stage
jreleaser.nexus2.start.stage

JRELEASER_DEPLOY_MAVEN_NEXUS2_${name}_START_STAGE
JRELEASER_DEPLOY_MAVEN_NEXUS2__START_STAGE
JRELEASER_NEXUS2_${name}_START_STAGE
JRELEASER_NEXUS2_START_STAGE

end

jreleaser.deploy.maven.nexus2.${name}.end.stage
jreleaser.deploy.maven.nexus2.end.stage
jreleaser.nexus2.${name}.end.stage
jreleaser.nexus2.end.stage

JRELEASER_DEPLOY_MAVEN_NEXUS2_${name}_END_STAGE
JRELEASER_DEPLOY_MAVEN_NEXUS2__END_STAGE
JRELEASER_NEXUS2_${name}_END_STAGE
JRELEASER_NEXUS2_END_STAGE

Rules for evaluation stages are as follows:

  • if no start.stage and end.stage are given then deployment process in its entirety as it’s currently done.

  • if only start.stage is given then deployment occurs from that stage til RELEASE.

  • if only end.stage is given then deployment occurs from the very beginning until that stage is reached.

  • if both start.stage and end.stage are given then deployment proceeds from the start stage to the end stage.

  • end.stage must be > than start.stage. When both are equal then only that single stage will be performed.

START END OUTCOME REQUIREMENTS

full deployment

UPLOAD

full deployment

UPLOAD

UPLOAD

only artifacts are uploaded

UPLOAD

CLOSE

upload artifacts and close repository

UPLOAD

RELEASE

full deployment

UPLOAD

only artifacts are uploaded

CLOSE

close and release repository

staged repository open

CLOSE

CLOSE

only close repository

staged repository open

CLOSE

RELEASE

close and release repository

staged repository open

CLOSE

upload artifacts and close repository

RELEASE

release repository

staged repository closed *

RELEASE

RELEASE

release repository

staged repository closed *

RELEASE

full deployment

Closing and releasing repositories will still be governed by the closeRepository and releaseRepository properties of the given deployer, that is, if start.stage is set to CLOSE, closeRepository is set to true, and releaseRepository is set to false then the matching repository will be closed but not released.

For simplicity, when start.stage is set to RELEASE and the target staged repository is still open, the deployer may close the repository if closeRepository is set to true, otherwise the expectation is to find the repository in a closed stated. Deployment fails if that’s not the case.

The Nexus2 deployer requires both the stagingProfileId and the stagingRepositoryId when stages are specified. These values may be calculated on the spot (matching credentials and target groupId). However, these values may also be passed using the following system properties or environment variables:

System Property Environment Variable

stagingProfileId

jreleaser.deploy.maven.nexus2.${name}.staging.profile.id
jreleaser.deploy.maven.nexus2.staging.profile.id
jreleaser.nexus2.${name}.staging.profile.id
jreleaser.nexus2.staging.profile.id

JRELEASER_DEPLOY_MAVEN_NEXUS2_${name}_STAGING_PROFILE_ID
JRELEASER_DEPLOY_MAVEN_NEXUS2__STAGING_PROFILE_ID
JRELEASER_NEXUS2_${name}_STAGING_PROFILE_ID
JRELEASER_NEXUS2_STAGING_PROFILE_ID

stagingRepositoryId

jreleaser.deploy.maven.nexus2.${name}.staging.repository.id
jreleaser.deploy.maven.nexus2.staging.repository.id
jreleaser.nexus2.${name}.staging.repository.id
jreleaser.nexus2.staging.repository.id

JRELEASER_DEPLOY_MAVEN_NEXUS2_${name}_STAGING_REPOSITORY_ID
JRELEASER_DEPLOY_MAVEN_NEXUS2__EN_STAGING_REPOSITORY_IDD_STAGE
JRELEASER_NEXUS2_${name}_STAGING_REPOSITORY_ID
JRELEASER_NEXUS2_STAGING_REPOSITORY_ID

Any mismatches with provided values results in deployment error and no modification of remote resources.

Determining the target staging repository requires finding out the latest modified repository in the correct state for the given execution stage, any mismatches result in deployment error.

This deployer writes the value of stagingProfileId and stagingRepositoryId to the output of the JReleaser process, typically out/jreleaser/output.properties from where you can grab their values and use them in the next invocation.

Here’s an example on how a 2 stage deployment may occur:

  • Artifacts deployed to a staged repository:

$ JRELEASER_NEXUS2_END_STAGE=CLOSE jreleaser deploy
  • Team members have the option to inspect deployed artifacts available from the closed staged repository.

  • Once the team approves the artifacts the release continues with:

$ JRELEASER_NEXUS2_START_STAGE=RELEASE jreleaser deploy

You may read the values for stagingProfileId and stagingRepositoryId from output.properties and set them as either system properties or environment variables for the second invocation.