Cannot debug using Gradle configuration after upgrading to IntelliJ IDEA 2025.

The Gradle version in my project is 7.6.1. However, it appears that the debugger is not using the Gradle version configured for my project. How can I resolve this issue?
The error log is listed as following:
FAILURE: Build failed with an exception.
* Where:
Initialization script '/private/var/folders/s5/4t03049n2wb2sw3twdvqhnv00000gp/T/ijJvmDebugger1.gradle' line: 19
* What went wrong:
Execution failed for task ':my-service:test'.
> 'void org.gradle.api.tasks.testing.Test.setForkEvery(long)'
* 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 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.6.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 14s
请先登录再写评论。
Hi Li Yu
This issue is already fixed in YouTrack IDEA-369597, please follow the workaround provided in the description at the top.
Apologies for the inconvenience.
Same problem when developing Liferay 7 portlets with recommended gradle version 7.x
Hi Alexei Malinovski
This issue is already fixed in YouTrack IDEA-369597, please follow the workaround provided in the description at the top.