我已经成功地发布到Artifact Registry,并且我可以在"正常的";使用:dependencies { implementation("mygroup:myartifact:myversion") }
。
我的问题是插件。我已经创建了一个插件。我可以成功地将它发布到Artifact注册表,也可以发布到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注册表中查找插件。我知道我错过了什么,但我不知道是什么。
使现代化
我从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]
你好,很抱歉回答晚了。我认为您错过了要添加到您的设置中的配置的这一部分。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")
此链接提供了更多详细信息。