7

我已成功发布到 Artifact Registry,我可以在“正常”使用中使用来自那里的工件:dependencies { implementation("mygroup:myartifact:myversion") }.

我的问题是插件。我创建了一个插件。我可以成功地将它发布到 Artifact Registry 以及本地的 Maven。我可以从本地 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 中寻找插件。我知道我错过了一些东西,但我不知道是什么。

...更新...

buildscript我从中删除build.gradle.kts,而是将其添加到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]
4

0 回答 0