Hello Gradle community,
I recently upgraded my project from Gradle 8.2 to 8.4, and I’m facing an issue with consuming snapshot dependencies from my Maven repository, where I have a Gradle plugin published. Everything was working fine with Gradle 8.2, but after the upgrade, I’m unable to resolve snapshot dependencies. Release publications do work though.
For better understanding, I’m trying to publish both the snapshots and release repositories in a local folder on my local machine.
I can consume the release publications without any issues, but not the snapshot ones.
In the project where I have hosted the Gradle plugin, I have a Gradle script called my-script.kts
, with a content similar to the following one:
plugins {
`maven-publish`
}
afterEvaluate {
publishing {
publications {
named<MavenPublication>("pluginMaven") {
groupId = project.properties[groupIdKey].toString()
artifactId = project.properties[artifactIdKey].toString()
version = version(project.properties[versionNameKey].toString())
}
}
repositories {
// Release Repository Definition
maven {
name = "release"
url = uri("path-to-my-local-folder")
}
// Snapshot Repository Definition
maven {
name = "snapshot"
url = uri("path-to-my-local-folder")
}
}
}
}
Then, in the build.gradle
of my Gradle plugin, I have:
plugins {
`java-gradle-plugin`
id(Kotlin.jvm)
`kotlin-dsl`
id("my-script")
}
version = version(project.properties[versionNameKey].toString())
group = project.properties[groupIdKey].toString()
gradlePlugin {
plugins {
create("myArtifactId") {
id = "mydomain.myArtifactId"
implementationClass = "com.mydomain.myClass"
}
}
}
Here’s the output after running the task
./gradlew publishAllPublicationsToSnapshotRepository
├── myArtifactId
│ ├── 2.0.0-alpha-5558-SNAPSHOT
│ │ ├── myArtifactId-2.0.0-alpha-5558-20240619.084912-1.jar
│ │ ├── myArtifactId-2.0.0-alpha-5558-20240619.084912-1.jar.md5
│ │ ├── myArtifactId-2.0.0-alpha-5558-20240619.084912-1.jar.sha1
│ │ ├── myArtifactId-2.0.0-alpha-5558-20240619.084912-1.jar.sha256
│ │ ├── myArtifactId-2.0.0-alpha-5558-20240619.084912-1.jar.sha512
│ │ ├── myArtifactId-2.0.0-alpha-5558-20240619.084912-1.module
│ │ ├── myArtifactId-2.0.0-alpha-5558-20240619.084912-1.module.md5
│ │ ├── myArtifactId-2.0.0-alpha-5558-20240619.084912-1.module.sha1
│ │ ├── myArtifactId-2.0.0-alpha-5558-20240619.084912-1.module.sha256
│ │ ├── myArtifactId-2.0.0-alpha-5558-20240619.084912-1.module.sha512
│ │ ├── myArtifactId-2.0.0-alpha-5558-20240619.084912-1.pom
│ │ ├── myArtifactId-2.0.0-alpha-5558-20240619.084912-1.pom.md5
│ │ ├── myArtifactId-2.0.0-alpha-5558-20240619.084912-1.pom.sha1
│ │ ├── myArtifactId-2.0.0-alpha-5558-20240619.084912-1.pom.sha256
│ │ ├── myArtifactId-2.0.0-alpha-5558-20240619.084912-1.pom.sha512
│ │ ├── maven-metadata.xml
│ │ ├── maven-metadata.xml.md5
│ │ ├── maven-metadata.xml.sha1
│ │ ├── maven-metadata.xml.sha256
│ │ └── maven-metadata.xml.sha512
│ ├── mydomain.myArtifactId.gradle.plugin
│ │ ├── 2.0.0-alpha-5558-SNAPSHOT
│ │ │ ├── mydomain.myArtifactId.gradle.plugin-2.0.0-alpha-5558-20240619.084912-1.pom
│ │ │ ├── mydomain.myArtifactId.gradle.plugin-2.0.0-alpha-5558-20240619.084912-1.pom.md5
│ │ │ ├── mydomain.myArtifactId.gradle.plugin-2.0.0-alpha-5558-20240619.084912-1.pom.sha1
│ │ │ ├── mydomain.myArtifactId.gradle.plugin-2.0.0-alpha-5558-20240619.084912-1.pom.sha256
│ │ │ ├── mydomain.myArtifactId.gradle.plugin-2.0.0-alpha-5558-20240619.084912-1.pom.sha512
│ │ │ ├── maven-metadata.xml
│ │ │ ├── maven-metadata.xml.md5
│ │ │ ├── maven-metadata.xml.sha1
│ │ │ ├── maven-metadata.xml.sha256
│ │ │ └── maven-metadata.xml.sha512
│ │ ├── maven-metadata.xml
│ │ ├── maven-metadata.xml.md5
│ │ ├── maven-metadata.xml.sha1
│ │ ├── maven-metadata.xml.sha256
│ │ └── maven-metadata.xml.sha512
│ ├── maven-metadata.xml
│ ├── maven-metadata.xml.md5
│ ├── maven-metadata.xml.sha1
│ ├── maven-metadata.xml.sha256
│ └── maven-metadata.xml.sha512
From the build.gradle of the project where I’m consuming the plugin I’m using:
plugins {
id("mydomain.myArtifactId") version "2.0.0-alpha-5558-SNAPSHOT"
}
But when I’m trying to consume the plugin in another project I get the following error:
- Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: ‘mydomain.myArtifactId’, version: ‘2.0.0-alpha-5558-SNAPSHOT’] was not found in any of the following sources:
And between the sources there are of course the release and snapshot repository i.e.,
maven(file:/path-to-my-local-folder/snapshot)
maven2(file:/path-to-my-local-folder/release)
I would appreciate any guidance or suggestions on resolving this issue with consuming snapshot dependencies after upgrading to Gradle 8.4, since I’ve been reviewing the release notes from 8.3 and 8.4 and saw nothing relevant to this that could be affecting.