MavenCentral

Deploys staged artifacts to Maven Central using the publisher API.

Publication of snapshots is not allowed.

Configuration

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

# 
deploy:
  maven:
    # 
    mavenCentral:
      # 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 MavenCentral service is enabled.
        # If left unspecified, the `JRELEASER_MAVENCENTRAL_${name}_URL`
        # environment variable must be defined.
        #  
        url: https://central.sonatype.com/api/v1/publisher

        # Activates publication of snapshot artifacts.
        # Defaults to `false`.
        # 
        snapshotSupported: true

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

        # Password for login into the MAVENCENTRAL service.
        # If left unspecified, the `JRELEASER_MAVENCENTRAL_${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 `BEARER`.
        # 
        authorization: BEARER

        # 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 rules 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 `.jar` artifact is staged.
            # 
            jar: false

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

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

            # Verifies that POM files comply with the minimum requirements for publication
            # to Maven Central. Checks rules using PomChecker.
            # 
            verifyPom: 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 `mavenCentral`, i.e, `mavenCentralFoo`.
          foo: bar

        # URL for checking artifacts may be already deployed.
        # Additional template tokens: `groupId`, `artifactId`, `version`, `path`, `filename`.
        #  
        verifyUrl: 'https://repo1.maven.org/maven2/{{path}}/{{filename}}'

        # Registered publication namespace.
        # Defaults to `${project.java.groupId}`.
        # 
        namespace: com.acme

        # Deployment identifier used for publication.
        # 
        deploymentId: dd9991b0-18a7-41e7-b1fe-37b8ea936f85

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

        # Maximum number of attempts to verify state transition.
        # Defaults to `60`.
        # 
        maxRetries: 60
# Deployers require a name.
# 
[deploy.maven.mavenCentral.app]

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

  # URL where the MavenCentral service is enabled.
  #  
  url = "https://central.sonatype.com/api/v1/publisher"

  # Activates publication of snapshot artifacts.
  # Defaults to `false`.
  # 
  snapshotSupported = true

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

  # Password for login into the MAVENCENTRAL 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 `BEARER`.
  # 
  authorization = "BEARER"

  # 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 rules 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.mavenCentral.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 `.jar` artifact is staged.
    # 
    jar = false

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

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

    # Verifies that POM files comply with the minimum requirements for publication
    # to Maven Central. Checks rules using PomChecker.
    # 
    verifyPom = 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 `mavenCentral`, i.e, `mavenCentralFoo`.

  # URL for checking artifacts may be already deployed.
  # Additional template tokens: `groupId`, `artifactId`, `version`, `path`, `filename`.
  #  
  verifyUrl: "https://repo1.maven.org/maven2/{{path}}/{{filename}}"

  # Registered publication namespace.
  # Defaults to `${project.java.groupId}`.
  # 
  namespace = "com.acme"

  # Deployment identifier used for publication.
  # 
  deploymentId = "dd9991b0-18a7-41e7-b1fe-37b8ea936f85"

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

  # Maximum number of attempts to verify state transition.
  # Defaults to `60`.
  # 
  maxRetries = 60
{
  // 
  "deploy": {
    "maven": {
      // 
      "mavenCentral": {
        // 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 MavenCentral service is enabled.
          //  
          "url": "https://central.sonatype.com/api/v1/publisher",

          // Activates publication of snapshot artifacts.
          // Defaults to `false`.
          // 
          "snapshotSupported": true,

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

          // Password for login into the MAVENCENTRAL 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 `BEARER`.
          // 
          "authorization": "BEARER",

          // 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 rules 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 `.jar` artifact is staged.
              // 
              "jar": false,

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

              // Verifies that a matching `-javadoc.jar` artifact is staged.
              // 
              "javadocJar": false,

              // Verifies that POM files comply with the minimum requirements for publication
              // to Maven Central. Checks rules using PomChecker.
              // 
              "verifyPom": 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 for checking artifacts may be already deployed.
          // Additional template tokens: `groupId`, `artifactId`, `version`, `path`, `filename`.
          //  
          "verifyUrl": "https://repo1.maven.org/maven2/{{path}}/{{filename}}",

          // Registered publication namespace.
          // Defaults to `${project.java.groupId}`.
          // 
          "namespace": "com.acme",

          // Deployment identifier used for publication.
          // 
          "deploymentId": "dd9991b0-18a7-41e7-b1fe-37b8ea936f85",

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

          // Maximum number of attempts to verify state transition.
          // Defaults to `60`.
          // 
          "maxRetries": 60,
          // Additional properties used when evaluating templates.
          // 
          "extraProperties": {
            // Key will be capitalized and prefixed with `mavenCentral`, i.e, `mavenCentralFoo`.
            "foo": "bar"
          }
        }
      }
    }
  }
}
<jreleaser>
  <!--
    
  -->
  <deploy>
    <maven>
      <!--
        
      -->
      <mavenCentral>
        <!--
          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 MavenCentral service is enabled.
             
          -->
          <url>https://central.sonatype.com/api/v1/publisher</url>

          <!--
            Activates publication of snapshot artifacts.
            Defaults to `false`.
            
          -->
          <snapshotSupported>true</snapshotSupported>

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

          <!--
            Password for login into the MAVENCENTRAL 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 `BEARER`.
            
          -->
          <authorization>BEARER</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 rules 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 `.jar` artifact is staged.
                
              -->
              <jar>false</jar>

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

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

              <!--
                Verifies that POM files comply with the minimum requirements for publication
                to Maven Central. Checks rules using PomChecker.
                
              -->
              <verifyPom>false</verifyPom>
            </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 `mavenCentral`, i.e, `mavenCentralFoo`.
            -->
            <foo>bar</foo>
          </extraProperties>

          <!--
            URL for checking artifacts may be already deployed.
            Additional template tokens: `groupId`, `artifactId`, `version`, `path`, `filename`.
             
          -->
          <verifyUrl>https://repo1.maven.org/maven2/{{path}}/{{filename}}</verifyUrl>

          <!--
            Registered publication namespace.
            Defaults to `${project.java.groupId}`.
            
          -->
          <namespace>com.acme</namespace>

          <!--
            Deployment identifier used for publication.
            
          -->
          <deploymentId>dd9991b0-18a7-41e7-b1fe-37b8ea936f85</deploymentId>

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

          <!--
            Maximum number of attempts to verify state transition.
            Defaults to `60`.
            
          -->
          <maxRetries>60</maxRetries>
        </app>
      </mavenCentral>
    </maven>
  </deploy>
</jreleaser>
jreleaser {
  // 
  deploy {
    maven {
      // 
      mavenCentral {
        // 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 MavenCentral service is enabled.
          //  
          url = 'https://central.sonatype.com/api/v1/publisher'

          // Activates publication of snapshot artifacts.
          // Defaults to `false`.
          // 
          snapshotSupported = true

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

          // Password for login into the MAVENCENTRAL 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 `BEARER`.
          // 
          authorization = 'BEARER'

          // 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 rules 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 `.jar` artifact is staged.
            // 
            jar = false

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

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

            // Verifies that POM files comply with the minimum requirements for publication
            // to Maven Central. Checks rules using PomChecker.
            // 
            verifyPom = 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 `mavenCentral`, i.e, `mavenCentralFoo`.
          // 
          extraProperties.put('foo', 'bar')

          // URL for checking artifacts may be already deployed.
          // Additional template tokens: `groupId`, `artifactId`, `version`, `path`, `filename`.
          //  
          verifyUrl = "https://repo1.maven.org/maven2/{{path}}/{{filename}}"

          // Registered publication namespace.
          // Defaults to `${project.java.groupId}`.
          // 
          namespace = 'com.acme'

          // Deployment identifier used for publication.
          // 
          deploymentId = 'dd9991b0-18a7-41e7-b1fe-37b8ea936f85'

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

          // Maximum number of attempts to verify state transition.
          // Defaults to `60`.
          // 
          maxRetries = 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.mavencentral.${name}.active
jreleaser.deploy.maven.mavencentral.active

JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_${name}_ACTIVE
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_ACTIVE

url

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

JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_${name}_URL
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_URL
JRELEASER_MAVENCENTRAL_${name}_URL
JRELEASER_MAVENCENTRAL_URL

username

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

JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_${name}_USERNAME
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_USERNAME
JRELEASER_MAVENCENTRAL_${name}_USERNAME
JRELEASER_MAVENCENTRAL_USERNAME

password

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

JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_${name}_PASSWORD
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_${name}_TOKEN
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_PASSWORD
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_TOKEN
JRELEASER_MAVENCENTRAL_${name}_PASSWORD
JRELEASER_MAVENCENTRAL_${name}_TOKEN
JRELEASER_MAVENCENTRAL_PASSWORD
JRELEASER_MAVENCENTRAL_TOKEN

namespace

jreleaser.deploy.maven.mavencentral.${name}.namespace
jreleaser.deploy.maven.mavencentral.namespace
jreleaser.mavencentral.${name}.namespace
jreleaser.mavencentral.namespace

JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_${name}_NAMESPACE
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_NAMESPACE
JRELEASER_MAVENCENTRAL_${name}_NAMESPACE
JRELEASER_MAVENCENTRAL_NAMESPACE

deploymentId

jreleaser.deploy.maven.mavencentral.${name}.deployment.id
jreleaser.deploy.maven.mavencentral.deployment.id
jreleaser.mavencentral.${name}.deployment.id
jreleaser.mavencentral.deployment.id

JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_${name}_DEPLOYMENT_ID
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_DEPLOYMENT_ID
JRELEASER_MAVENCENTRAL_${name}_DEPLOYMENT_ID
JRELEASER_MAVENCENTRAL_DEPLOYMENT_ID

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:
    mavenCentral:
      app:
        active: ALWAYS
        url: https://central.sonatype.com/api/v1/publisher
        stagingRepositories:
          - target/staging-deploy
[deploy.maven.mavenCentral.app]
  active = "ALWAYS"
  url = "https://central.sonatype.com/api/v1/publisher"
  stagingRepositories = ["target/staging-deploy"]
{
  "jreleaser": {
    "deploy": {
      "maven": {
        "mavenCentral": {
          "app": {
            "active": "ALWAYS",
            "url": "https://central.sonatype.com/api/v1/publisher",
            "stagingRepositories": [
              "target/staging-deploy"
            ]
          }
        }
      }
    }
  }
}
<jreleaser>
  <deploy>
    <maven>
      <mavenCentral>
        <app>
          <active>ALWAYS</active>
          <url>https://central.sonatype.com/api/v1/publisher</url>
          <stagingRepositories>target/staging-deploy</stagingRepositories>
        </app>
      </mavenCentral>
    </maven>
  </deploy>
</jreleaser>
jreleaser {
  deploy {
    maven {
      mavenCentral {
        app {
          active = 'ALWAYS'
          url = 'https://central.sonatype.com/api/v1/publisher'
          stagingRepository('target/staging-deploy')
        }
      }
    }
  }
}

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

  • JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_APP_USERNAME

  • JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_USERNAME

  • JRELEASER_MAVENCENTRAL_APP_USERNAME

  • JRELEASER_MAVENCENTRAL_USERNAME

  • JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_APP_PASSWORD

  • JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_APP_TOKEN

  • JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_PASSWORD

  • JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_TOKEN

  • JRELEASER_MAVENCENTRAL_APP_PASSWORD

  • JRELEASER_MAVENCENTRAL_APP_TOKEN

  • JRELEASER_MAVENCENTRAL_PASSWORD

  • JRELEASER_MAVENCENTRAL_TOKEN

Staged Deployments

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

System Property Environment Variable

stage

jreleaser.deploy.maven.mavencentral.${name}.stage
jreleaser.deploy.maven.mavencentral.stage
jreleaser.mavencentral.${name}.stage
jreleaser.mavencentral.stage

JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_${name}_STAGE
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_STAGE
JRELEASER_MAVENCENTRAL_${name}_STAGE
JRELEASER_MAVENCENTRAL_STAGE

The MavenCentral deployer requires the deploymentId property to be set when the stage is set to PUBLISH.

This deployer writes the value of namespace and deploymentId 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_MAVENCENTRAL_STAGE=UPLOAD 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_MAVENCENTRAL_STAGE=PUBLISH jreleaser deploy

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