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.
Publication of snapshots is not allowed.

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

# 
deploy:
  maven:
    # 
    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: __DO_NOT_SET_HERE__

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

        # 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

        # 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

        # 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

        # 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
# 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.
  # 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 = "__DO_NOT_SET_HERE__"

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

  # 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

  # 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

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

  # 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": {
      // 
      "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": "__DO_NOT_SET_HERE__",

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

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

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

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

          // 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>
      <!--
        
      -->
      <nexus2>
        <!--
          Deployers require a name.
          
        -->
        <app>
          <!--
            Enables or disables the distribution.
            Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
            Defaults to `NEVER`.
            
          -->
          <active>ALWAYS</active>

          <!--
            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</url>;

          <!--
            The username required for authorization.
            If left unspecified, the `JRELEASER_NEXUS2_${name}_USERNAME`
            environment variable must be defined.
             
          -->
          <username>__DO_NOT_SET_HERE__</username>

          <!--
            Password for login into the NEXUS2 service.
            If left unspecified, the `JRELEASER_NEXUS2_${name}_PASSWORD`
            environment variable must be defined.
             
          -->
          <password>__DO_NOT_SET_HERE__</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>

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

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

          <!--
            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 {
      // 
      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 = '__DO_NOT_SET_HERE__'

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

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

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

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

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

Url

You may set the url in the configuration as shown above, or you can have it read from an environment variable. The configured name of the Nexus2 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_NEXUS2_NAME_URL. If your instance is named production, you can store the host in the environment variable JRELEASER_NEXUS2_PRODUCTION_URL. The name will be transformed to uppercase.

Username

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

You may set the username set in the configuration as shown above, or you can have it read from an environment variable. The configured name of the Nexus2 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_NEXUS2_NAME_USERNAME. If your instance is named production, you can store the username in the environment variable JRELEASER_NEXUS2_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 Nexus2 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_NEXUS2_NAME_PASSWORD. If your instance is named production, you need to store the secret in the environment variable JRELEASER_NEXUS2_PRODUCTION_PASSWORD. The name will be transformed to uppercase.

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