Plugin is Incompatible with Gradle 8.1
mikewacker opened this issue · 2 comments
What happened?
This plugin doesn't work with Gradle 8.1.1, but it does work with Gradle 8.0.2.
Steps to Reproduce
- Create a single-project Java application with Gradle (e.g.,
gradle init
) with these files:
app/build.gradle.kts
:
plugins {
application
}
repositories {
mavenCentral()
}
dependencies {
implementation("com.google.guava:guava")
}
application {
mainClass.set("example.App")
}
app/src/main/java/example/App.java
:
package example;
import com.google.common.collect.ImmutableList;
public final class App {
public static void main(String[] args) {
ImmutableList<Integer> list = ImmutableList.of(3);
System.out.println(list.get(0));
}
}
build.gradle.kts
:
plugins {
id("com.palantir.consistent-versions") version "2.12.0"
}
repositories {
mavenCentral()
}
settings.gradle.kts
:
rootProject.name = "example"
include("app")
versions.props
:
com.google.guava:guava = 31.1-jre
- Build the project (with the current version of Gradle) to verify it works:
./gradlew --write-locks
,./gradlew run
- Upgrade to Gradle 8.0.2, and run it again:
./gradlew wrapper --gradle-version 8.0.2
,./gradlew run
- Run with warning mode enabled:
./gradlew --warning-mode all run
./gradlew --warning-mode all run
> Configure project :
The compileClasspathCopy configuration has been deprecated for dependency declaration. This will fail with an error in Gradle 9.0. Please use another configuration instead. Consult the upgrading guide for further information: https://docs.gradle.org/8.0.2/userguide/upgrading_version_5.html#dependencies_should_no_longer_be_declared_using_the_compile_and_runtime_configurations
The runtimeClasspathCopy configuration has been deprecated for dependency declaration. This will fail with an error in Gradle 9.0. Please use another configuration instead. Consult the upgrading guide for further information: https://docs.gradle.org/8.0.2/userguide/upgrading_version_5.html#dependencies_should_no_longer_be_declared_using_the_compile_and_runtime_configurations
The testCompileClasspathCopy configuration has been deprecated for dependency declaration. This will fail with an error in Gradle 9.0. Please use another configuration instead. Consult the upgrading guide for further information: https://docs.gradle.org/8.0.2/userguide/upgrading_version_5.html#dependencies_should_no_longer_be_declared_using_the_compile_and_runtime_configurations
The testRuntimeClasspathCopy configuration has been deprecated for dependency declaration. This will fail with an error in Gradle 9.0. Please use another configuration instead. Consult the upgrading guide for further information: https://docs.gradle.org/8.0.2/userguide/upgrading_version_5.html#dependencies_should_no_longer_be_declared_using_the_compile_and_runtime_configurations
- Upgrade to Gradle 8.1.1:
./gradlew wrapper --gradle-version 8.1.1
- Run it again:
./gradlew run
./gradlew build
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'example'.
> Cannot change the allowed usage of configuration ':app:compileClasspathCopy', as it was locked upon creation to the role: 'Deprecated Resolvable'.
This role permits the following usage:
Consumable - this configuration can be selected by another project as a dependency (but this behavior is marked deprecated)
Resolvable - this configuration can be resolved by this project to a set of files
Declarable Against - this configuration can have dependencies added to it (but this behavior is marked deprecated)
Ideally, each configuration should be used for a single purpose.
(To downgrade Gradle after this error occurs, you may need to to manually change gradle/wrapper/gradle-wrapper.properties
.)
I also went ahead and created a corresponding repository to reproduce this issue:
https://github.com/mikewacker/gradle-consistent-versions-1046
It uses Gradle 8.0.2. As you can see, the PR to upgrade it to Gradle 8.1.1 fails:
https://github.com/mikewacker/gradle-consistent-versions-1046/pull/1
https://github.com/mikewacker/gradle-consistent-versions-1046/actions/runs/4968897906/jobs/8891775432?pr=1