Home > OS >  Pull plugin "com.google.cloud.artifactregistry.gradle-plugin" fail because "Failed to
Pull plugin "com.google.cloud.artifactregistry.gradle-plugin" fail because "Failed to

Time:12-09

I included plugin "com.google.cloud.artifactregistry.gradle-plugin" in my gradle project.

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

I always get an error message during pulling:

Failed to apply plugin 'com.google.cloud.artifactregistry.gradle-plugin'.
Failed to get access token from gcloud or Application Default Credentials

Anyone knows why? I see it mentioned in this post https://github.com/GoogleCloudPlatform/artifact-registry-maven-tools/issues/34. that I need to have a GCP account first. I downloaded the GCP SDK, and logged in to my account, but still get the same message. Anyone can provide more specific solution? Thanks.

CodePudding user response:

I've not tried this

Have a look at Setting up Authentication for Grade in Google's Artifact Registry docs.

Hopefully you can use the credential helper

Application Default Credentials is a very useful Google platform feature that simplifies obtaining credentials. Code (not gcloud) running:

  • off-GCP (locally or e.g. GitHub|GitLab) can be configured to use credentials through an environment variable setting (GOOGLE_APPLICATION_CREDENTIALS)
  • on-GCP (e.g. Compute Engine) obtains the credentials automatically (e.g. Metadata service).

I suspect (!) that the Maven|Gradle plugins looks for GOOGLE_APPLICATION_CREDENTIALS in this way to authenticate (using a Service Account) your script to Google.

  • Related