Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0

When I try to run Java project from IntelliJ IDEA, I get this error

Execution failed for task ':ISO8583Request.main()'.
> Process 'command 'C:\Program Files\Eclipse Adoptium\jdk-11.0.22.7-hotspot\bin\java.exe'' finished with non-zero exit value 1

* 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 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.4/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 2s
2 actionable tasks: 1 executed, 1 up-to-date

I have Gradle 8.4 installed.

I tried multiple solutions from StackOverflow, but nothing helped. Any ideas? And how it’s reportind incomaptability with Gradle version that isn’t released yet (9)?

I don’t understand the question.

You use something that is marked as deprecated with planned removal for Gradle 9, so even with Gradle 9 not released yet, you already now know that you cannot upgrade to Gradle 9 without fixing that once it is released and could right away fix that incompatibility.

To know what exactly is the problem, it also tells you how to find out.
Just run with warning mode all.
If a build from commandline does not show the same deprecation warning, you can also increase the warning mode using gradle.properties as documented in the User Guide.

I’ve created gradle.properties file in the project root dir, and put --warning-mode=all. When I try to run, I get the same message, nothing verbose. I also tried to add this flag into run options inside my IDE, and still nothing (no verbose log).

If you put it to the arguments in IDE, you are configuring what is given to your class, not what is given to Gradle.
And you cannot just write the command-line option into the properties file, that’s why I said “as documented in the User Guide” as I don’t have it in my head what you need exactly and assume you can look it up yourself. :wink:

I wrote simple Java app with main method, and want to run it. When I run it from my IDE, I get the error that is in the first post. I just need to run it.

Well that warning does not prevent running, it is just a warning.
The process is started and ends with exit code 1 which then in turn makes the Gradle build fail.
Scroll up whether you output the problem, or run through debug and set a breakpoint to investigate what is happening.
That is not a Gradle topic, but just your program ending with non-0 exit code.

We started facing the same error, some builds when running check task started to fail without anything else than that message.

Checking the build scan, no task failed, only that info. The stack trace:

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0
Exception
org.gradle.api.GradleException: Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0	
	at org.gradle.internal.featurelifecycle.LoggingDeprecatedFeatureHandler.featureUsed(LoggingDeprecatedFeatureHandler.java:86)	
	at org.gradle.internal.deprecation.DeprecationLogger.nagUserWith(DeprecationLogger.java:348)	
	at org.gradle.internal.deprecation.DeprecationLogger.nagUserWith(DeprecationLogger.java:247)	
	at org.gradle.internal.deprecation.DeprecationMessageBuilder$WithDocumentation.nagUser(DeprecationMessageBuilder.java:140)	
	at org.gradle.api.tasks.testing.AbstractTestTask.emitDeprecationMessage(AbstractTestTask.java:552)	
	at org.gradle.api.tasks.testing.AbstractTestTask.handleCollectedResults(AbstractTestTask.java:536)	
	at org.gradle.api.tasks.testing.AbstractTestTask.executeTests(AbstractTestTask.java:528)	
	at org.gradle.api.tasks.testing.Test.executeTests(Test.java:715)	
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)	
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)	
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)	
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)	
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)	
	at org.gradle.api.internal.tasks.execution.TaskExecution$3.run(TaskExecution.java:244)	
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)

Using --stacktrace I managed to identify the issue.
In our case is a combination of predictive test selection returning 0 tests (correct) with the test task failing because the no tests were executed.

The log shows:

No test executed. This behavior has been deprecated. This will fail with an error in Gradle 9.0. There are test sources present but no test was executed. Please check your test configuration. Consult the upgrading guide for further information: https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#test_task_fail_on_no_test_executed

But no where it tell really that is the cause of the failure. Also, this happens because predictive test selection resulted in 0 tests. I would expect it to automatically understand that is fine and not an issue.

So on our case the issues I see:

  • the failure is not clear, it is failing on the test task but no where it shows as failed (not in console, not in scan)
  • test task fails because no test was selected by predictive selection, that should automatically work

(btw, gradle version is 8.7)

Seems like the issues are fixed in https://plugins.gradle.org/plugin/com.gradle.enterprise/3.17:

- [FIX] Predictive Test Selection: Gradle displays a "no test executed" deprecation warning when no tests are selected on Gradle 8.3 and later
1 Like