maven Google Cloud Artifact Registry for Gradle插件

js81xvg6  于 2023-06-21  发布在  Maven
关注(0)|答案(1)|浏览(135)

我已经成功地发布到Artifact Registry,我可以在“正常”使用中使用Artifact:dependencies { implementation("mygroup:myartifact:myversion") }
我的问题是插件。我创建了一个插件。我可以成功地将其发布到Artifact Registry和Maven local。我可以从Maven本地使用它,但是我不能让我的构建脚本从Artifact Registry获取它。

buildscript {
    repositories {
        maven(url = uri("artifactregistry://us-west1-maven.pkg.dev/glitchy-maven/repo"))
    }
}

plugins {
    id("com.google.cloud.artifactregistry.gradle-plugin") version "2.1.1"
    id("com.glitchybyte.gradle.plugin.buildinfo") version "1.0.0"
    `java-library`
}

我得到:

* What went wrong:
Plugin [id: 'com.glitchybyte.gradle.plugin.buildinfo', version: '1.0.0'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.glitchybyte.gradle.plugin.buildinfo:com.glitchybyte.gradle.plugin.buildinfo.gradle.plugin:1.0.0')
  Searched in the following repositories:
    Gradle Central Plugin Repository

因此,它不会在Artifact Registry中查找插件。我知道我错过了什么,但我不知道是什么。
更新...
我从build.gradle.kts中删除了buildscript,并将其添加到settings.gradle.kts中:

pluginManagement {
    plugins {
        id("com.google.cloud.artifactregistry.gradle-plugin") version "2.1.1"
    }
    repositories {
        maven(url = uri("artifactregistry://us-west1-maven.pkg.dev/glitchy-maven/repo"))
    }

我得到:

* What went wrong:
Error resolving plugin [id: 'com.glitchybyte.gradle.plugin.buildinfo', version: '1.0.0']
> Could not resolve all dependencies for configuration 'detachedConfiguration1'.
   > Not a supported repository protocol 'artifactregistry': valid protocols are [http, https, file, gcs, s3, sftp]
nle07wnf

nle07wnf1#

你好,很抱歉回答晚了。我认为您缺少要添加到settings.gradle.kts中的这部分配置

buildscript {
    repositories {
        maven {
            url = uri("https://plugins.gradle.org/m2/")          }
    }
    dependencies {
        classpath("gradle.plugin.com.google.cloud.artifactregistry:artifactregistry-gradle-plugin:2.2.0")
    }
}
apply(plugin =  "com.google.cloud.artifactregistry.gradle-plugin")

更多细节请参见此链接。

相关问题