请选择 进入手机版 | 继续访问电脑版
  • 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

GoogleCloudPlatform/artifact-registry-maven-tools

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

GoogleCloudPlatform/artifact-registry-maven-tools

开源软件地址(OpenSource Url):

https://github.com/GoogleCloudPlatform/artifact-registry-maven-tools

开源编程语言(OpenSource Language):

Java 100.0%

开源软件介绍(OpenSource Introduction):

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.4</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.4"
}

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.4"
  }
}

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.4"
  }
}

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



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap