Getting deprecated warnings about javaexec

I am using gradle 8 and I only use the JavaExecTask. I get warnings about that javaexec is deprecated. The JavaExecSpec.main property has been deprecated. When I look in the documentation for JavaExecTask for gradle 9 it is not deprecated.

How can make the build gradle 9 compatible?

Is it that the JavaExecTask in gradle 8 uses the deprecated methods?

When I look in the documentation for JavaExecTask for gradle 9 it is not deprecated.

If you really use JavaExecTask, then you do use some plugin, there is no such class in Gradle.
If you instead mean JavaExec and looked at its JavaDoc for Gradle 9, setMain is of course not deprecated, it does not even exist there, if you see it, you look at something different.
If you look at the JavaDoc for Gradle 8, it is shown as deprecated.

How you can make your build Gradle 9 compatible is hard to guess without you showing any code or at least a --stacktrace or optimally a build --scan URL if possible.

I only use JavaExec tasks in the build script. The log points to the lines where I have JavaExec.

All tasks is created with

tasks.register(‘taskName’, JavaExec) { … }

This is one of them.

tasks.register(‘jaxb_ebms’, JavaExec) {
group “Build tasks”
description = ‘Generate model classes using JAXB XJC tool’
outputs.dir genDir

classpath = configurations.jaxb
systemProperties(\['javax.xml.accessExternalSchema': 'all','javax.xml.accessExternalDTD': 'all'\])
main = 'com.sun.tools.xjc.Driver'
args '-extension'
args '-d', genDir.get().getAsFile().getPath()
args schemaDir + '/ebms-header-3_0-200704.xsd'
args '-b', schemaDir + "/binding/ebms-header-3_0-200704.xjb"
}

I think I’ve gotten it now. It is main that should be mainClass?

This link in the report is dead,

https://docs.gradle.org/8.11.1/dsl/org.gradle.process.JavaExecSpec.html#org.gradle.process.JavaExecSpec:main

Exactly.

The wrong link you could report as bug on GitHub, maybe it will get fixed for an 8.14.5 if one is coming. :man_shrugging:
The correct link would probably be JavaExecSpec (Gradle API 8.11.1)