This repository contains a Gradle plugin to help with interacting with Maven repositories hosted on Artifact Registry.
It used to be a copy of Artifact Registry Maven Tools but only for Gradle and more up to date.
Apply the plugin:
- In
build.gradle.kts
for single module projects - In
settings.gradle.kts
for multi module projects
id("io.github.bjoernmayer.artifactregistryGradlePlugin") version "<VERSION>"
If you see weird errors like NoSuchMethod
, you might need to pin down the guava version for your buildscript:
// root settings.gradle.kts
buildscript {
dependencies {
classpath("com.google.guava:guava:33.2.0-jre")
}
}
Requests to Artifact Registry will be authenticated using credentials from the environment. The plugin searches the environment for credentials in the following order (default):
- Google Application Default Credentials.
- Note: It is possible to set Application Default Credentials for a user account via
gcloud auth login --update-adc
orgcloud auth application-default login
- Note: It is possible to set Application Default Credentials for a user account via
- From the
gcloud
SDK. (i.e., the access token printed viagcloud 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)'
- Hint: You can see which account is active with the command
You can change this order or disable providers like this:
artifactRegistry {
applicationDefault {
// enable.set(false) // default true
order.set(2) // default 1
}
gCloudSDK {
// enable.set(false) // default true
order.set(1) // default 2
}
}