quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.64k stars 2.64k forks source link

Quarkus-Gradle-Plugin uses deprecated methods #39221

Open mschorsch opened 7 months ago

mschorsch commented 7 months ago

Describe the bug

The Quarkus-Gradle-Plugin uses deprecated methods

...
> Configure project :server
The resolvable usage is already allowed on configuration ':server:quarkusGeneratedSourcesRuntimeClasspath'. This behavior has been deprecated. This behavior is scheduled to be removed in Gradle 9.0. Remove the call to setCanBeResolved(true), it has no effect. Consult the upgrading guide for further informat
ion: https://docs.gradle.org/8.6/userguide/upgrading_version_8.html#redundant_configuration_usage_activation
The resolvable usage is already allowed on configuration ':server:quarkusTestGeneratedSourcesRuntimeClasspath'. This behavior has been deprecated. This behavior is scheduled to be removed in Gradle 9.0. Remove the call to setCanBeResolved(true), it has no effect. Consult the upgrading guide for further info
rmation: https://docs.gradle.org/8.6/userguide/upgrading_version_8.html#redundant_configuration_usage_activation
...
> Task :server:quarkusGenerateCode
The BuildIdentifier.getName() method has been deprecated. This is scheduled to be removed in Gradle 9.0. Use getBuildPath() to get a unique identifier for the build. Consult the upgrading guide for further information: https://docs.gradle.org/8.6/userguide/upgrading_version_8.html#build_identifier_name_and_
current_deprecation
...

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

reproducer.zip

Run ./gradlew clean build --console=plain --warning-mode=all --rerun-tasks --build-cache --parallel

Output of uname -a or ver

No response

Output of java -version

Java 17

Quarkus version or git rev

Quarkus 3.8.1

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 8.6

Additional information

No response

quarkus-bot[bot] commented 7 months ago

/cc @glefloch, @quarkusio/devtools

mschorsch commented 5 months ago

@aloubyansky: You have been mentioned in other issues in connection with Gradle and the Quarkus plugin so I hope you can help here.

aloubyansky commented 5 months ago

I don't see setCanBeResolved(true) calls in our code, there must be something else triggering these.

mschorsch commented 5 months ago

Tested with Quarkus 3.9.4, Quarkus 999-SNAPSHOT and Gradle 8.7. The deprecation warning is still there.

ryandens commented 5 months ago

I'm also still seeing this deprecation warning for BuildIdentifier.getName() which looks like it is being used in by the quarkus class io.quarkus.gradle.tooling.dependency.DependencyUtils based on this stacktrace:

at org.gradle.api.internal.artifacts.DefaultBuildIdentifier.getName(DefaultBuildIdentifier.java:48) 
    at io.quarkus.gradle.tooling.dependency.DependencyUtils.getExtensionInfoOrNull(DependencyUtils.java:100)    
    at io.quarkus.gradle.dependency.ConditionalDependenciesEnabler.collectConditionalDependencies(ConditionalDependenciesEnabler.java:94)   
    at io.quarkus.gradle.dependency.ConditionalDependenciesEnabler.<init>(ConditionalDependenciesEnabler.java:51)   
    at io.quarkus.gradle.dependency.ApplicationDeploymentClasspathBuilder.lambda$setUpDeploymentConfiguration$10(ApplicationDeploymentClasspathBuilder.java:205)    
    at org.gradle.api.internal.provider.DefaultProvider.calculateOwnValue(DefaultProvider.java:72)

link to usage of deprecated method in source: https://github.com/quarkusio/quarkus/blob/9a768bbec0f3e9db839d7bf61f8594174999380c/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/dependency/DependencyUtils.java#L100

The deprecated method recommends using getBuildPath instead and to use that for comparing builds to compare included builds. It looks like this value is comapred in ToolingUtils.includedBuild:

https://github.com/quarkusio/quarkus/blob/9a768bbec0f3e9db839d7bf61f8594174999380c/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/ToolingUtils.java#L54

so just updating both locations to use BuildIdentifier.getBuildPath instead of BuildIdentifier.getName would be sufficient to help prepare quarkus builds for Gradle 9.

mschorsch commented 5 months ago

Thranks @ryandens

@aloubyansky Tested with Quarkus 3.9.5 + Gradle 8.7

./gradlew clean build --warning-mode=all --rerun-tasks --build-cache --parallel --stacktrace

Here is the full stacktrace: full_stacktrace.md. Maybe this helps.