Skip to content

Update to Gradle 9.0.0 and update plugin versions - #755

Merged
wmdietl merged 6 commits into
mainfrom
gradle-9.0.0
Sep 23, 2025
Merged

wmdietl merged 6 commits into
mainfrom
gradle-9.0.0

Conversation

@wmdietl

@wmdietl wmdietl commented Aug 4, 2025

Copy link
Copy Markdown
Collaborator

Update of Gradle also required some plugin updates. I tried to go through all versions I found.

Running

 > ./gradlew clean jar --warning-mode all

> Task :jar
Invocation of Task.project at execution time has been deprecated. This will fail with an error in Gradle 10. This API is incompatible with the configuration cache, which will become the only mode supported by Gradle in a future release. Consult the upgrading guide for further information: https://docs.gradle.org/9.0.0/userguide/upgrading_version_7.html#task_project

[Incubating] Problems report is available at: file:///home/wdietl/workspaces-server/jspecify/jspecify/build/reports/problems/problems-report.html

BUILD SUCCESSFUL in 744ms
6 actionable tasks: 6 executed

I didn't immediately see where the jar task is using Task.project. Maybe here?

@cpovirk

cpovirk commented Aug 5, 2025

Copy link
Copy Markdown
Collaborator

Thanks. Your theory sounds like a good one to me, especially now that I've glanced at enough docs to land on https://docs.gradle.org/current/userguide/configuration_cache_requirements.html#config_cache:requirements:use_project_during_execution. This seems familiar, like maybe you've looked into it before?

@wmdietl

wmdietl commented Aug 5, 2025

Copy link
Copy Markdown
Collaborator Author

I commented out the two jar blocks as an experiment and still get the deprecation warning.
I wish gradle would give a line number with where the invalid access happens.

@tbroyer

tbroyer commented Aug 5, 2025

Copy link
Copy Markdown

I wish gradle would give a line number with where the invalid access happens.

Isn't it in the Problems report? Or at a minimum when running with --stacktrace?

@wmdietl

wmdietl commented Aug 5, 2025

Copy link
Copy Markdown
Collaborator Author

I wish gradle would give a line number with where the invalid access happens.

Isn't it in the Problems report? Or at a minimum when running with --stacktrace?

When I run ./gradlew clean jar --warning-mode all --info --stacktrace I don't see any mention of a gradle file in the error report or the stack trace.

> Task :jar
Custom actions are attached to task ':jar'.
Caching disabled for task ':jar' because:
  Build cache is disabled
  Not worth caching
Task ':jar' is not up-to-date because:
  Task has failed previously.
file or directory 'jspecify/build/resources/main', not found
file or directory 'jspecify/build/resources/java9', not found
Invocation of Task.project at execution time has been deprecated. This will fail with an error in Gradle 10. This API is incompatible with the configuration cache, which will become the only mode supported by Gradle in a future release. Consult the upgrading guide for further information: https://docs.gradle.org/9.0.0/userguide/upgrading_version_7.html#task_project
        at org.gradle.internal.cc.impl.DeprecatedFeaturesListener.nagUserAbout(DeprecatedFeaturesListener.kt:98)
        at org.gradle.internal.cc.impl.DeprecatedFeaturesListener.onProjectAccess(DeprecatedFeaturesListener.kt:70)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:587)
        at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:557)
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:84)
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:70)

When I turn on the gradle configuration cache, the warning turns into an error.
The stack trace looks different, but I still don't see what line causes the issue:

> Task :jar FAILED 
Caching disabled for task ':jar' because: 
  Build cache is disabled
  Not worth caching
Task ':jar' is not up-to-date because:
  Task has failed previously.
file or directory 'jspecify/build/resources/main', not found
file or directory 'jspecify/build/resources/java9', not found

1 problem was found storing the configuration cache.
- Task `:jar` of type `org.gradle.api.tasks.bundling.Jar`: invocation of 'Task.project' at execution time is unsupported with the configuration cache.
  See https://docs.gradle.org/9.0.0/userguide/configuration_cache_requirements.html#config_cache:requirements:use_project_during_execution

See the complete report at file://jspecify/build/reports/configuration-cache/c6e9ya7aq2hissmf5q8hj3r61/5rjb5oev5a24bj3ge0xi2sojp/configuration-cache-report.html

[Incubating] Problems report is available at: file://jspecify/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':jar'.
> Invocation of 'Task.project' by task ':jar' at execution time is unsupported with the configuration cache. 

* Try:
> Run with --debug option to get more log output.
> Run with --scan to generate a Build Scan (Powered by Develocity).
> Get more help at https://help.gradle.org.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':jar'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:135)
        at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:288)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:133)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:121)
        at org.gradle.api.internal.tasks.execution.ProblemsTaskPathTrackingTaskExecuter.execute(ProblemsTaskPathTrackingTaskExecuter.java:41)
        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)

@wmdietl

wmdietl commented Sep 19, 2025

Copy link
Copy Markdown
Collaborator Author

Sorry, finally got back to this.
I found a workaround for the bnd issue.

I also tried updating to Gradle 9.1.0 which was released today, but that fails with:

Declaring dependencies using multi-string notation has been deprecated. This will fail with an error in Gradle 10. Please use single-string notation instead: "org.jspecify:jspecify". Consult the upgrading guide for further information: https://docs.gradle.org/9.1.0/userguide/upgrading_version_9.html#dependency_multi_string_notation

The location the error html file gives is just biz.aQute.bnd.builder. I haven't looked at whether there is a workaround for that.

I did also enable the gradle configuration cache and made a small tweak to make that work. I would be thankful if a gradle expert could review the PR again.

@cpovirk

cpovirk commented Sep 19, 2025

Copy link
Copy Markdown
Collaborator

I would be thankful if a gradle expert could review the PR again.

Gemini likes it, and that's a more meaningful endorsement than I can provide. Additional volunteer human reviews remain welcome.

@tbroyer

tbroyer commented Sep 19, 2025

Copy link
Copy Markdown

I also tried updating to Gradle 9.1.0 which was released today, but that fails with:

Declaring dependencies using multi-string notation has been deprecated. This will fail with an error in Gradle 10. Please use single-string notation instead: "org.jspecify:jspecify". Consult the upgrading guide for further information: https://docs.gradle.org/9.1.0/userguide/upgrading_version_9.html#dependency_multi_string_notation

The location the error html file gives is just biz.aQute.bnd.builder. I haven't looked at whether there is a workaround for that.

This is likely https://github.com/bndtools/bnd/blob/64fd326a78851d14ab266ee77d7927b06a93f747/gradle-plugins/biz.aQute.bnd.gradle/src/main/java/aQute/bnd/gradle/BndBuilderPlugin.java#L109-L110 and I don't think there's a workaround; the BND plugin would have to be updated.

@wmdietl

wmdietl commented Sep 23, 2025

Copy link
Copy Markdown
Collaborator Author

Thanks for all the comments!

@wmdietl
wmdietl merged commit 9ef8c51 into main Sep 23, 2025
@wmdietl
wmdietl deleted the gradle-9.0.0 branch September 23, 2025 13:52
@wmdietl

wmdietl commented Feb 3, 2026

Copy link
Copy Markdown
Collaborator Author

The bnd warning is fixed by the updates in #789.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants