Cloud Build Artifacts common authentication library

Common authentication library for connecting to Cloud Build Artifacts.

License

License

GroupId

GroupId

com.google.cloud.buildartifacts
ArtifactId

ArtifactId

buildartifacts-auth-common
Last Version

Last Version

1.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

Cloud Build Artifacts common authentication library
Common authentication library for connecting to Cloud Build Artifacts.
Project URL

Project URL

https://github.com/GoogleCloudPlatform/build-artifacts-maven-tools
Source Code Management

Source Code Management

https://github.com/GoogleCloudPlatform/build-artifacts-maven-tools

Download buildartifacts-auth-common

How to add to project

<!-- https://jarcasting.com/artifacts/com.google.cloud.buildartifacts/buildartifacts-auth-common/ -->
<dependency>
    <groupId>com.google.cloud.buildartifacts</groupId>
    <artifactId>buildartifacts-auth-common</artifactId>
    <version>1.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.google.cloud.buildartifacts/buildartifacts-auth-common/
implementation 'com.google.cloud.buildartifacts:buildartifacts-auth-common:1.2.1'
// https://jarcasting.com/artifacts/com.google.cloud.buildartifacts/buildartifacts-auth-common/
implementation ("com.google.cloud.buildartifacts:buildartifacts-auth-common:1.2.1")
'com.google.cloud.buildartifacts:buildartifacts-auth-common:jar:1.2.1'
<dependency org="com.google.cloud.buildartifacts" name="buildartifacts-auth-common" rev="1.2.1">
  <artifact name="buildartifacts-auth-common" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.google.cloud.buildartifacts', module='buildartifacts-auth-common', version='1.2.1')
)
libraryDependencies += "com.google.cloud.buildartifacts" % "buildartifacts-auth-common" % "1.2.1"
[com.google.cloud.buildartifacts/buildartifacts-auth-common "1.2.1"]

Dependencies

compile (2)

Group / Artifact Type Version
com.google.http-client : google-http-client jar 1.30.2
com.google.auth : google-auth-library-oauth2-http jar 0.16.2

Project Modules

There are no modules declared in this project.

Artifact Registry Maven Tools

This repository contains tools to help with interacting with Maven repositories hosted on Artifact Registry.

Authentication

Requests to Artifact Registry will be authenticated using credentials from the environment. The tools described below search the environment for credentials in the following order:

  1. Google Application Default Credentials.
    • Note: It is possible to set Application Default Credentials for a user account via gcloud auth login --update-adc or gcloud auth application-default login
  2. From the gcloud SDK. (i.e., the access token printed via gcloud config config-helper --format='value(credential.access_token)')
    • Hint: You can see which account is active with the command gcloud config config-helper --format='value(configuration.properties.core.account)'

Maven Setup

The Artifact Registry Wagon is an implementation of the Maven Wagon API which allows you to configure Maven to interact with repositories stored in Artifact Registry.

To enable the wagon, add the following configuration to the pom.xml in your project root:

    <extensions>
        <extension>
            <groupId>com.google.cloud.artifactregistry</groupId>
            <artifactId>artifactregistry-maven-wagon</artifactId>
            <version>2.1.0</version>
        </extension>
    </extensions>

You can then configure repositories by using the "artifactregistry://" prefix. In this example the repository is in 'us-west1', you should use the correct location for your repository.

  <repositories>
    <repository>
      <id>my-repository</id>
      <url>artifactregistry://us-west1-maven.pkg.dev/PROJECT_ID/REPOSITORY_ID</url>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

Where

  • PROJECT_ID is the ID of the project.
  • REPOSITORY_ID is the ID of the repository.

Gradle Setup

To use Artifact Registry repositories with gradle, add the following configuration to the build.gradle file in your project. In this example the repository is in 'us-west1', you should use the correct location for your repository.

plugins {
  id "com.google.cloud.artifactregistry.gradle-plugin" version "2.1.0"
}

repositories {
    maven {
      url 'artifactregistry://us-west1-maven.pkg.dev/PROJECT_ID/REPOSITORY_ID'
    }
}

publishing {
    repositories {
        maven {
          url 'artifactregistry://us-west1-maven.pkg.dev/PROJECT_ID/REPOSITORY_ID'
        }
    }
}

Where

  • PROJECT_ID is the ID of the project.
  • REPOSITORY_ID is the ID of the repository.

Alternatives

If you need to use Artifact Registry repositories inside your init.gradle or settings.gradle, the plugin can also be used inside init.gradle or settings.gradle files.

  • To use plugin inside init.gradle file:
initscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.com.google.cloud.artifactregistry:artifactregistry-gradle-plugin:2.1.0"
  }
}

apply plugin: com.google.cloud.artifactregistry.gradle.plugin.ArtifactRegistryGradlePlugin
  • To use plugin inside settings.gradle file:
buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.com.google.cloud.artifactregistry:artifactregistry-gradle-plugin:2.1.0"
  }
}

apply plugin: "com.google.cloud.artifactregistry.gradle-plugin"
com.google.cloud.buildartifacts

Google Cloud Platform

Versions

Version
1.2.1
1.2.0
1.1.3
1.1.2
1.1.1
1.1.0