Gitlab

Deploys staged artifacts to a Gitlab instance via its Maven Packages option.

This feature does not support deploying artifacts other than JARs and POMs to a Maven compatible repository. If you need to upload any other binaries then check the Gitlab Uploader.
Publication of snapshots is not allowed.

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

    # 
    gitlab:
      # 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 Gitlab service is enabled.
        # If left unspecified, the `JRELEASER_GITLAB_${name}_URL`
        # environment variable must be defined.
        #  
        url: https://gitlab.com/api/v4/projects/12345678/packages/maven

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

        # Password for login into the GITLAB service.
        # If left unspecified, the `JRELEASER_GITLAB_${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 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 `gitlab`, i.e, `gitlabFoo`.
          foo: bar

        # The id of the GitLab repository.
        # 
        projectIdentifier: 12345678
[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.gitlab.app]

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

  # URL where the Gitlab service is enabled.
  #  
  url = "https://gitlab.com/api/v4/projects/12345678/packages/maven"

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

  # Password for login into the GITLAB 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 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.gitlab.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 `gitlab`, i.e, `gitlabFoo`.

  # The id of the GitLab repository.
  # 
  projectIdentifier = "12345678"
{
  // 
  "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
      },

      // 
      "gitlab": {
        // 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 Gitlab service is enabled.
          //  
          "url": "https://gitlab.com/api/v4/projects/12345678/packages/maven",

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

          // Password for login into the GITLAB 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 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,

          // The id of the GitLab repository.
          // 
          "projectIdentifier": "12345678",

          // Additional properties used when evaluating templates.
          // 
          "extraProperties": {
            // Key will be capitalized and prefixed with `gitlab`, i.e, `gitlabFoo`.
            "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>
      <!--
        
      -->
      <gitlab>
        <!--
          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 Gitlab service is enabled.
             
          -->
          <url>https://gitlab.com/api/v4/projects/12345678/packages/maven</url>

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

          <!--
            Password for login into the GITLAB 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 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 `gitlab`, i.e, `gitlabFoo`.
            -->
            <foo>bar</foo>
          </extraProperties>

        <!--
           The id of the GitLab repository.
           
        -->
        <projectIdentifier>12345678</projectIdentifier>
        </app>
      </gitlab>
    </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
      }

      // 
      gitlab {
        // 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 Gitlab service is enabled.
          //  
          url = 'https://gitlab.com/api/v4/projects/12345678/packages/maven'

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

          // Password for login into the GITLAB 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 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 `gitlab`, i.e, `gitlabFoo`.
          // 
          extraProperties.put('foo', 'bar')

        // The id of the GitLab repository.
        // 
        projectIdentifier = '12345678'

        }
      }
    }
  }
}

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.gitlab.${name}.active
jreleaser.deploy.maven.gitlab.active

JRELEASER_DEPLOY_MAVEN_GITLAB_${name}_ACTIVE
JRELEASER_DEPLOY_MAVEN_GITLAB_ACTIVE

url

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

JRELEASER_DEPLOY_MAVEN_GITLAB_${name}_URL
JRELEASER_DEPLOY_MAVEN_GITLAB_URL
JRELEASER_GITLAB_${name}_URL
JRELEASER_GITLAB_URL

username

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

JRELEASER_DEPLOY_MAVEN_GITLAB_${name}_USERNAME
JRELEASER_DEPLOY_MAVEN_GITLAB_USERNAME
JRELEASER_GITLAB_${name}_USERNAME
JRELEASER_GITLAB_USERNAME

password

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

JRELEASER_DEPLOY_MAVEN_GITLAB_${name}_PASSWORD
JRELEASER_DEPLOY_MAVEN_GITLAB_${name}_TOKEN
JRELEASER_DEPLOY_MAVEN_GITLAB_PASSWORD
JRELEASER_DEPLOY_MAVEN_GITLAB_TOKEN
JRELEASER_GITLAB_${name}_PASSWORD
JRELEASER_GITLAB_${name}_TOKEN
JRELEASER_GITLAB_PASSWORD
JRELEASER_GITLAB_TOKEN

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:
    gitlab:
      app:
        active: ALWAYS
        url: https://gitlab.com/api/v4/projects/12345678/packages/maven
        projectIdentifier: 12345678
        stagingRepositories:
          - target/staging-deploy
[deploy.maven.gitlab.app]
  active = "ALWAYS"
  host = "https://gitlab.com/api/v4/projects/12345678/packages/maven"
  projectIdentifier = "12345678"
  stagingRepositories = ["target/staging-deploy"]
{
  "jreleaser": {
    "deploy": {
      "maven": {
        "gitlab": {
          "app": {
            "active": "ALWAYS",
            "host": "https://gitlab.com/api/v4/projects/12345678/packages/maven",
            "projectIdentifier": "12345678",
            "stagingRepositories": [
              "target/staging-deploy"
            ]
          }
        }
      }
    }
  }
}
<jreleaser>
  <deploy>
    <maven>
      <gitlab>
        <app>
          <active>ALWAYS</active>
          <host>https://gitlab.com/api/v4/projects/12345678/packages/maven</host>
          <projectIdentifier>12345678</projectIdentifier>
          <stagingRepositories>target/staging-deploy</stagingRepositories>
        </app>
      </gitlab>
    </maven>
  </deploy>
</jreleaser>
jreleaser {
  deploy {
    maven {
      gitlab {
        app {
          active = 'ALWAYS'
          host = 'https://gitlab.com/api/v4/projects/12345678/packages/maven'
          projectIdentifier = '12345678'
          stagingRepository('target/staging-deploy')
        }
      }
    }
  }
}

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

  • JRELEASER_DEPLOY_MAVEN_GITLAB_APP_USERNAME

  • JRELEASER_DEPLOY_MAVEN_GITLAB_USERNAME

  • JRELEASER_GITLAB_APP_USERNAME

  • JRELEASER_GITLAB_USERNAME

  • JRELEASER_DEPLOY_MAVEN_GITLAB_APP_PASSWORD

  • JRELEASER_DEPLOY_MAVEN_GITLAB_APP_TOKEN

  • JRELEASER_DEPLOY_MAVEN_GITLAB_PASSWORD

  • JRELEASER_DEPLOY_MAVEN_GITLAB_TOKEN

  • JRELEASER_GITLAB_APP_PASSWORD

  • JRELEASER_GITLAB_APP_TOKEN

  • JRELEASER_GITLAB_PASSWORD

  • JRELEASER_GITLAB_TOKEN