Integrated: 8360586: JavaFX build uses deprecated features that will be removed in gradle 9
Ambarish Rapte
arapte at openjdk.org
Tue Oct 14 08:25:59 UTC 2025
On Tue, 23 Sep 2025 21:08:50 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:
> **Issue**:
> Below two Gradle 9.0.0 specific warnings are observed with current grade 8.14.2
> 1. The `Project.exec(Closure)` method has been deprecated. This is scheduled to be removed in Gradle 9.0
> 2. Using method `javaexec(Closure)` has been deprecated. This is scheduled to be removed in Gradle 9.0.
>
> Both these methods are removed in Gradle 9.0.0.
> Hence they should be replaced with appropriate APIs.
> Refer: https://docs.gradle.org/8.14.2/userguide/upgrading_version_8.html#deprecated_project_exec
>
> **Fix**:
> Both warnings can be fixed by replacing the calls with` ExecOperations.exec(Action)`.
> There are two different scenarios where we use the above two APIs.
> - Gradle files
> - Groovy class files
> => In Both the scenarios, we have to use the `ExecOperations.exec(Action)`, but the approach differs.
>
> 1. Gradle file
> - The calls are simply replaced as,
> * `Project.exec {` is replaced with `execOps.exec { ExecSpec spec ->`
> * `Project.javaexex {` is replaced with `execOps.javaexec { JavaExecSpec spec ->`
> 2. For Groovy classes
> - `ExecOperations` needs to be **injected** using `@Inject` tag
> 1. `NativeCompileTask` class
> - In the `NativeCompileTask` class, a method `execCompile()` is added which executes an action.
> - The child classes of `NativeCompileTask`, use this `execCompile()` method.
> 2. Other classes are not related to each other. They independently execute the respective action.
>
> **Verification**:
> 1. Run all gradle tasks with **—warning-mode all** option, with gradle 8.14.2
> 2. No Gradle 9.0.0 specific warning is seen in build log
> 4. Build/all tasks complete successfully.
This pull request has now been integrated.
Changeset: c61e2697
Author: Ambarish Rapte <arapte at openjdk.org>
URL: https://git.openjdk.org/jfx/commit/c61e269703952318d3437d07a572049200326ff5
Stats: 238 lines in 13 files changed: 120 ins; 1 del; 117 mod
8360586: JavaFX build uses deprecated features that will be removed in gradle 9
Reviewed-by: kcr, sykora
-------------
PR: https://git.openjdk.org/jfx/pull/1918
More information about the openjfx-dev
mailing list