Google Cloud Artifact Registry for Gradle plugins - maven

I have successfully published to Artifact Registry, and I can use artifacts from there in "normal" use: dependencies { implementation("mygroup:myartifact:myversion") }.
My issue is plugins. I have created a plugin. I can successfully publish it to Artifact Registry and also to Maven local. I can use it from Maven local, but I can't get my build script to take it from 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`
}
And I get:
* 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
So, it's not looking into Artifact Registry for plugins. I know I'm missing something, but I don't know what.
...Update...
I removed buildscript from build.gradle.kts, and instead I added this to 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"))
}
And I get:
* 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]

Related

avro gradle plugin failing to build using gradle

I am trying to build the avro gradle plugin using gradle and even though I had set my settings.gradle as :
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
and build.gradle :
plugins {
id "com.github.davidmc24.gradle.plugin.avro" version "1.3.0"
}
repositories {
mavenCentral()
}
dependencies {
implementation "org.apache.avro:avro:1.11.0"
}
generateAvroJava {
source("${projectDir}/src/main/resources/avro")//sourcepath avrofile
}
while executing the gradle build I get the errors below:
* Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.github.davidmc24.gradle.plugin.avro', version: '1.11.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.github.
not sure if I am missing something that is causing it to fail. any ideas.. thanks.

How to use snapshot repository for openapi gradle plugin?

I would like to use snapshot repository for open API generator in Gradle. However it still cannot find the plugin.
settings.gradle.kts
pluginManagement {
repositories {
maven {
name = "sonatype"
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
}
gradlePluginPortal()
}
}
build.gradle.kts
plugins {
id("org.openapi.generator") version "6.3.0-SNAPSHOT"
}
Error:
Plugin [id: 'org.openapi.generator', version: '6.3.0-SNAPSHOT'] was not found in any of the following sources:
It seems like it is still pointing to the gradle plugin portal.
The URL of the snapshot is
https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-gradle-plugin/6.3.0-SNAPSHOT
You need to update groupId (org.openapitools) and artifactid (openapi-generator-gradle-plugin)

Spring native can't be found

Can't add spring native to an existing project, if I create a new one with spring native selected it works.
org.gradle.internal.exceptions.LocationAwareException: Build file
'/Users/jakob/Documents/worklivery-backend/build.gradle.kts' line: 6
Plugin [id: 'org.springframework.experimental.aot', version: '0.10.4']
was not found in any of the following sources:
Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
plugins{
...
id("org.springframework.experimental.aot") version "0.10.4"
}
repositories {
mavenCentral()
maven { url = uri("https://repo.spring.io/release") }
}
The AOT plugin isn't published to Gradle's plugin portal, it's only available from https://repo.spring.io. You need to add some configuration to your project's settings.gradle file so that it can be resolved:
pluginManagement {
repositories {
maven { url 'https://repo.spring.io/release' }
mavenCentral()
gradlePluginPortal()
}
}
The above matches the configuration from a project generated by https://start.spring.io and adds Maven Central and https://repo.spring.io/release to the plugin repositories in addition to the default Gradle Plugin Portal.

Gradle: Meecrowave plugin not found

I'm trying to configure meecrowave gradle plugin according to this documentation:
This is my script:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.apache.meecrowave:meecrowave-gradle-plugin:1.2.6"
}
}
plugins {
id 'java'
id 'org.apache.meecrowave.meecrowave'
}
meecrowave {
httpPort = 9090
}
I'm getting this error message:
Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-5.0-bin.zip'.
Build file '/home/jcabre/projectes/digital/espaidoc/security/build.gradle' line: 12
Plugin [id: 'org.apache.meecrowave.meecrowave'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)
Plugin [id: 'org.apache.meecrowave.meecrowave'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)
I've also tried with:ยด
plugins {
id 'java'
id 'org.apache.meecrowave.meecrowave' version '1.2.6'
}
Then I get this message:
Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-5.0-bin.zip'.
Build file '/home/jcabre/projectes/digital/espaidoc/security/build.gradle' line: 12
Plugin [id: 'org.apache.meecrowave.meecrowave', version: '1.2.6'] 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 'org.apache.meecrowave.meecrowave:org.apache.meecrowave.meecrowave.gradle.plugin:1.2.6')
Searched in the following repositories:
Gradle Central Plugin Repository
Plugin [id: 'org.apache.meecrowave.meecrowave', version: '1.2.6'] 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 'org.apache.meecrowave.meecrowave:org.apache.meecrowave.meecrowave.gradle.plugin:1.2.6')
Searched in the following repositories:
Gradle Central Plugin Repository
PARENT GRADLE
plugins {
id "base"
id 'com.github.spotbugs' version '1.6.8' apply false
id 'io.franzbecker.gradle-lombok' version '2.0' apply false
id 'fish.payara.micro-gradle-plugin' version '1.0.0' apply false
}
apply from: "$projectDir/gradle/java.gradle"
apply from: "$projectDir/gradle/spotbugs.gradle"
apply from: "$projectDir/gradle/checkstyle.gradle"
apply from: "$projectDir/gradle/pmd.gradle"
apply from: "$projectDir/gradle/jacoco.gradle"
apply from: "$projectDir/gradle/repositories.gradle"
apply from: "$projectDir/gradle/payara.gradle"
The problem is that this plugin is not published to the official Gradle plugins portail , so you cannot use plugins {} DSL (or you need to configure the pluginManagement.resolutionStrategy, see enter link description here )
The other problem is that the documentation you mentioned is not up-to-date !
The plugin ID has been changed to org.apache.microwave.microwave
Easiest way to apply this plugin:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.apache.meecrowave:meecrowave-gradle-plugin:1.2.6"
}
}
// use "new" plugin ID
apply plugin: "org.apache.microwave.microwave"
// or use directly PLugin class
//apply plugin: org.apache.meecrowave.gradle.MeecrowavePlugin
EDIT see Romain's answer for more accurate details about this issue.
just to let you know that the plugin id issue was not a "renaming" but a forgotten renaming (originally meecrowave was named microwave before joining openwebbeans project).
I fixed the plugin id in https://issues.apache.org/jira/browse/MEECROWAVE-186 and updated the doc to reflect that. Note that the doc is not in the sources itself but online at http://openwebbeans.apache.org/meecrowave/meecrowave-gradle/index.html.
Romain

Gradle dependency management plugin

I am trying to run the following minimal gradle build file including the dependency management plugin:
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
}
plugins {
id "java"
id "io.spring.dependency-management" version "1.0.4.RELEASE"
}
But then running gradle fails:
* What went wrong:
Plugin [id: 'io.spring.dependency-management', version: '1.0.4.RELEASE'] 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 'io.spring.dependency-management:io.spring.dependency-management.gradle.plugin:1.0.4.RELEASE')
Searched in the following repositories:
Gradle Central Plugin Repository
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.5.1/userguide/command_line_interface.html#sec:command_line_warnings
Is there a missing dependency in the gradle file?
The plugin cannot be found because you defined repositories inside your build script and tried to use plugin outside it. Remove buildscript or add repositories for your build file also.
(Dependencies and repositories defined inside build script are accessible in that buildscript scope)
Example:
plugins {
id "java"
id "io.spring.dependency-management" version "1.0.4.RELEASE"
}
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}

Resources