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.

1 Like

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

Same problem.


PS E:\Projects\Project ....\........> ./gradlew build                                                                                                              

[Incubating] Problems report is available at: file:///E:/Projects/Project%20..../......../build/reports/problems/problems-report.html

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.12.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD SUCCESSFUL in 30s
21 actionable tasks: 21 executed

This doesn’t seem like a

That is not a Gradle topic, but just your program ending with non-0 exit code.

This is by no means an isolated case. Whoever thinks so
 well
 I can only think that they have no idea.

what is this?

Buenas tardes agradeceria su ayuda con lo siguiente:
Estoy generando los snippets en un proyecto de automatizacion y al ejecutarlo me arroja este mensaje:

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 Command-Line Interface Reference in the Gradle documentation.

There seems to be an issue with gradle and the implementation of tests. (What kind of error? I have no idea, I didn’t program Gradle)
This seems to be some incompatibility or it will be deprecated in the future by Gradle. (Why? no idea)

Let’s start
1 - It shows us this warning

PS E:\Projects\test\.......> ./gradlew build
Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended

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

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.12.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD SUCCESSFUL in 27s

We are incubating a potential bug.
Why is it flagging 9.0? I think “Gradle” is doing something new or a viewer or who knows what with the tests.

2 - If we try with --warning-mode all:


PS E:\Projects\test\..........> ./gradlew clean build --warning-mode all
Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended

> Task :profile-service:test
The automatic loading of test framework implementation dependencies has been deprecated. This is scheduled to be removed in Gradle 9.0. Declare the desired test framework directly on the test suite or explicitly declare the test framework implementation dependencies on the test's runtime classpath. Consult the upgrading guide for further information: https://docs.gradle.org/8.12.1/userguide/upgrading_version_8.html#test_framework_implementation_dependencies
No test executed. This behavior has been deprecated. This will fail with an error in Gradle 9.0. There Test sources are present but no test was executed. Please check your test configuration. Consult the upgrading guide for further information: https://docs.gradle.org/8.12.1/userguide/upgrading_version_8.html#test_task_fail_on_no_test_executed

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

BUILD SUCCESSFUL in 23s

We observed “The automatic loading of test framework implementation dependencies has been deprecated.”

As I said at the beginning, it seems that gradle and junit tests don’t go hand in hand or something has happened. Anyone can go to git and look at the history. I don’t have time.

3 - If we put the following code in build.gradle.kts to be able to see all the potential problems: In my case spring boot gradle kotlin dsl.

dependencies {
        // PARA LOS PERFILES TESTS
        testImplementation("org.springframework.boot:spring-boot-starter-test")
        testImplementation("org.junit.jupiter:junit-jupiter-api")
        testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
        testImplementation("com.h2database:h2")
}

tasks.withType<Test> {
        useJUnitPlatform()
}

In my case, I had other problems, but the main one is


PS E:\Projects\test\..........> ./gradlew clean build --warning-mode all
Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended

> Task :profile-service:test

ProfileApplicationTests > contextLoads() FAILED
 java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:180
 Caused by: org.springframework.beans.factory.BeanCreationException at AutowiredAnnotationBeanPostProcessor.java:515
 Caused by: org.springframework.util.PlaceholderResolutionException at PlaceholderResolutionException.java:81

1 test completed, 1 failed

> Task :profile-service:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':profile-service:test'.
> There were failing tests. See the report at: file:///E:/Projects/test/........../profile-service/build/reports/tests/test/index.html

* Try:
> Run with --scan to get full insights.

BUILD FAILED in 36s
16 actionable tasks: 16 executed

This microservice did not have the tests implemented nor the application.properties, that is why it failed.
A - Datasource error
B - (Solving case 1) MySQL error

If this microservice does not have an application.properties in src/test/java/com/resources/, then it will directly take the path of src\main\resources\application.properties, that is, the official path of your microservice. In my case it is pointing to MySQL (kubernetes) so it does not work.

4 - Create the application.properties in test : (Put “EVERYTHING” that your application uses)
your_microservice\src\test\resources\application-test.properties

spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=update
// In my case I added kafka below because I need it.

Then you use

Conclusion. If we want to disable the warning, we have to put all the tests and especially

tasks.withType<Test> {
  systemProperty("spring.profiles.active", "test")
}

Also remember to add the “test” annotation since we have called it application-“test”.properties

@SpringBootTest
@ActiveProfiles("test")
class ProfileApplicationTests {

    @Test
    void contextLoads() {
    }

}

This is called profiles. You can activate it from application.properties with “spring.profiles.active=test”. But it is not necessary, since with application-test.properties it is exactly the same. Unless you have different types of tests (very rare).
Note: What you can have in the main are different profiles like “dev”, “prod”
 but in the /src/test/java/com/
 section you do not have more than one property.
English:Note: It ended up like this:

tasks.withType<Test> {
        useJUnitPlatform()
        systemProperty("spring.profiles.active", "test")
        testLogging {
            events("passed", "skipped", "failed")
            exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
            showExceptions = true
            showCauses = true
            showStackTraces = true
        }
    }

Solution, you can keep the warning and let “Gradle” update it in the future.

Although by the time Gradle 9.0 arrives all projects will crash. So do what I said if you want to go to the latest version. That’s why an error is brewing. Since you have to configure the “test”, yes or yes, since it will be mandatory.

Did it work for me? NO. I still get errors. I fix them as they come in to continue the chain of meaningless errors.

This may not be clear at first, but think about it, it’s the only post on the “ENTIRE” Internet where it is explained in detail.
My recommendation? Keep the warning. Why? Hopefully they will change it in the future.
I’m off.

This doesn’t seem like a

That is not a Gradle topic, but just your program ending with non-0 exit code.

This is by no means an isolated case.

You misunderstood most probably @drakgoku and you do do not have the same problem.
OP has a BUILD FAILED and additionally a deprecation warning.
You have a BUILD SUCCESSFUL and a deprecation warning.
The deprecation warnings do not cause the build to fail, that was just a misinterpretation by OP.
Why the build of OP was failing was what my comment you quoted was referring to and what OP actually wanted to know in this thread.

What deprecation warnings you get and why of course are Gradle topics, but actually not really related to this thread.

About the deprecation warnings you found in point 2 of your last post, they also show you links where it exactly describes what the deprecated behavior is and how to fix it, so what is unclear?

About all that comes in your last post starting with point 3, I have no idea why you posted it or how you think it is in any way related. Seems more like a description how to fix your Spring Boot tests.

I don’t know what you mean with “they will change it in the future”.
It happened occasionally, that deprecations were removed again from Gradle code or their removal delayed to a later point in time, but I would count on that.
There is usually no reason at all to ignore warnings and you should usually just fix them, especially if it is easy and well documented.

Let’s go by points.

1 - The real problem is the following warning.

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

Are we talking about this warning or not? It’s just a monosyllable. Same error given in different cases as we have seen in the logs of each person in this post. The answer? Yes. There is nothing to discuss.

2 - What does this warning do? Why does the warning appear?
A priori we cannot know. “We have no idea and we have to go with debugging or go to the gradle notes and look at the test section.”
To decipher this nonsense you will need, as I said, to put: tasks.withType {useJUnitPlatform()} with

            exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
            showExceptions = true
            showCauses = true
            showStackTraces = true

its logs as I showed above to follow the entire chain.
Hence my post.
Why this nonsense if it already comes by default? Easy. Note that all the errors in this post about the gradle 9.0 deprecation warning are related to testing.

3 - We all have the same problem and the only driver is the test.

If I’m so wrong
 there must be many of us. I’d like to avoid this warning if possible, since I always update to the latest version when the version is released.

Hide the post as you did since you don’t think it’s related. But if the backend is talking about this at least show them the post. Since they’re doing something wrong from Gradle with JUNIT.

If I were you, I would discuss it with the Gradle backend. If you don’t want to, don’t worry, I’ll keep the warning and keep working. When the time comes, you’ll see.

I don’t know why the hell I’m wasting my time if it’s literally “your job to find the error”. But since in 2024 you didn’t find it and the only clue I already gave you
 but you decided to hide or delete my post
 I’m done with that.

The real problem is the following warning.

That might be your problem.
It is not the problem of this thread and original poster.
As I said, original poster had a failing build and wrongly attributed it that warning while a warning never makes the build fail.
So to OP and thus this thread, that warning is not the real problem but absolutely irrelevant.

What does this warning do?

Exactly what it says.
It warns you, that somewhere something deprecated was used
and that your build will not be compatible with Gradle 9 most likely
and how to get more information about what deprecations were found.

Why does the warning appear?

The warning tells you.
Because you used something deprecated that will make your build fail in a later major version of Gradle.

To decipher this nonsense you will need, as I said

Now we are getting a bit closer maybe.

While not at all talking about the topic of OP and thus being off-topic and should create an own thread,
you are not talking about

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

as this can have dozens of reasons.
What you talk about is about one specific deprecation warning (even you yourself had multiple different deprecation warnings), namely the “No test executed.” deprecation.

This specific deprecation warning again can have dozens of reasons why it actually happens and “To decipher this nonsense you will need, as I said” will often not help at all to find the reason. It just might have helped in your specific case.
The deprecation warning only says “Gradle has seen you wanted to execute tests but no test was reported to be executed, as this is most likely an error somewhere this is deprecated and will fail in the future to protect you.”
This deprecation warning can for example also come when you use JUnit 5 and did not include the proper test engine as dependency as then your tests are not discovered, or if you write them in some JUnit 5 engine but did not configure the test task to use JUnit 5, or if the test engine you are using somehow cannot discover any tests to run for some reason, 

All the warning says is “hey, there were no tests run, this is most probably an error, have a look into it”.

Why this nonsense if it already comes by default? Easy.

Not sure what you mean here.
What is nonsense and what comes by default?

Note that all the errors in this post about the gradle 9.0 deprecation warning are related to testing.

There is only one error in this thread, which is the actual problem of OP and is neither related in any way to testing nor to any deprecation warning.

And whether all deprecation warnings in this thread are related to testing, neither of us can even know, as OP never shared what his deprecation warning was, besides that it is irrelevant to his problem and thus this thread.

I’d like to avoid this warning if possible, since I always update to the latest version when the version is released.

That’s a very good idea.
I welcome anyone that fixes warnings as warnings are way too often ignored.
But actually iirc you were the one recommending the warning.

Hide the post as you did since you don’t think it’s related.

There is no need to write in bold, my eyes are fine.
There is also no need to blame me of anything.
Just because you assume things, doesn’t make them any more true.
I did not hide any post, I was just trying to help.
Even with you right in your first post insulting me by saying I “have no idea”, while it was you who just did not get the topic here correctly and why the answer is correct.

But if the backend is talking about this at least show them the post. Since they’re doing something wrong from Gradle with JUNIT.

Not sure what you mean.
If you think Gradle is doing something wrong, open a bug report.
I’m just a user like you trying to help other users.

I don’t know why the hell I’m wasting my time if it’s literally “your job to find the error”.

Interesting, I didn’t know that this is my job.
Neither is my employer, which is not Gradle Inc.
That’s just yet another wrong assumption done by you.

You should really work on your communication skills and try to adhere to the code of conduct.
Maybe some moderator did hide your post because you did not adhere to it. :man_shrugging:

I like how the discussion has evolved and the perspective of me that you have presented. I don’t have much time to go through quote by quote, but let me share my perspective:

  • I partially agree with your argument. You focus the problem on the specific error of ':ISO8583Request.main()', while I focus on the warning that appears in the Gradle output.

  • Although the main error is the failed build, and in my case I mean a successful build with warnings, both scenarios share the same warning. This warning is what I am putting my attention on.

  • The user can use commands like:

./gradlew ISO8583Request.main() --stacktrace --info --debug

to diagnose the specific problem of the failed build. However, the topic we are discussing here is the deprecation and its possible relation to the error.

  • The question arises: How is it possible that in different scenarios (failed build and successful build) the same warning appears? There is a conjunction between both cases, and we should not rule out that the warning may be related to the error. Are you sure there is no connection?

  • My focus is not on the failed build, but on the warning that appears:

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

This message given in both scenarios, indicates that deprecated Gradle features are being used, why? no idea, and most likely it could generate compatibility problems in the future.

  • The core problem here is the incompatibility with Gradle 9.0, even when this version has not yet been released. This is what seems most relevant to me.

Discussion about who is right:

  • User: “I have this problem.”
  • Vampire Björn Kautler: “This is not a Gradle issue, but your program ended with an exit code other than 0.”
  • Me: “All the issues could be related to the same warning. The error is probably there.”
  • Vampire Björn Kautler: “That could be your problem.”

There is not much more to discuss. This is probably a sensitive code-related issue, and that’s why it’s easier to attribute it to a mistake on our part. I get it. When someone loses focus, it’s important to get back to the essentials.


Conclusion:

The warning about deprecated Gradle features is an important issue that should not be ignored, even if it is not the direct cause of the build failure. Both issues (the error and the warning) should be addressed separately, but it is crucial to consider whether they could be related. Gradle 9.0 incompatibility is an indicator that something in the project configuration needs attention, regardless of whether it is the direct cause of the current error.

That being said, if you claim that they are not relevant.

  • I would recommend changing the title
  • I would recommend deleting everything that has Gradle.
    Likewise, I’m going to create a thread, with the same name, with the same deprecation hoping that it doesn’t get blocked twice since this one has exactly the same name, same warning


Note: If it’s not your job to facilitate communication between the backend and users, or help solve technical issues related to Gradle, then what exactly is your job? Moderating the forum? Because I honestly don’t understand what you’re doing here if it’s not to help the community.

Someone who participates in a technical forum like this has a job. If that job is not to help users solve problems or clarify doubts, then I don’t know what your purpose is. Could you clarify?

You focus the problem on the specific error of ':ISO8583Request.main()' , while I focus on the warning that appears in the Gradle output.

Yes, but the topic of the thread is what problem the original poster had, and that was the failed build, not the deprecation warning that he wrongly associated with the build failure. :slight_smile:

This warning is what I am putting my attention on.

Yes, and which has nothing to do with the problem of the OP, that’s why I said it is off-topic here and is better discussed in a separate thread. :slight_smile:

The user can use commands like:

Actually he can not that easy, as the ...main() tasks are auto-generated on the fly by IntelliJ Gradle integration. :smiley:

the deprecation and its possible relation to the error.

Which is exactly 0, you can take that for granted. :slight_smile:

How is it possible that in different scenarios (failed build and successful build) the same warning appears?

Why should it not?
It is in no way related to the build error.
The warning warns you about something deprecated in Gradle that you used, but it is just a warning and does not make the build fail, so the build continues after the reason for the warning happened.
So it can still be successful afterwards, or fail due to some reason.
Nevertheless something deprecated was used in the build and the user is warned about that fact, whether the build was successful thereafter of failed doesn’t matter, the deprecation is there either way.
Is just happens occasionally that someone wrongly attributes a build failure the warning like OP did, but a Gradle warning will never make a build fail (unless there is a bug of course).

There is a conjunction between both cases

This is a typical case of “correlation, not causality”.
The build failed, and there was a deprecation warning.
But neither has anything to do with the other.

and we should not rule out that the warning may be related to the error

Why should we not?
They are in no way at all related.
So we even must rule it out.

  • Are you sure there is no connection?

Yes.
The first two lines of OP’s log clearly show that the build failure is because his code that he runs through the IDE is exiting with exit code 1, which makes the build fail.
Whatever the deprecation is that Gradle warns about in OP’s case is not related to it, whatever it is.
I can say that with pretty high confidence even without knowing what deprecation it complains about.

why? no idea, and most likely it could generate compatibility problems in the future.

Yes, and it will make problems in future Gradle versions.
And it exactly tells you which deprecations were found if you follow the instructions, including web-links with further more detailed explanation and instructions.

  • Me: “All the issues could be related to the same warning. The error is probably there.”
  • Vampire Björn Kautler: “That could be your problem.”

That’s not what I said.
What I said was, that the warning has nothing to do with the build error which simply is a fact.
That you also have deprecation warnings - be it the same as OP or not we will probably never know as he didn’t share his - of course is not good and you should take action on it. It is just not related to the topic of OP.

The warning about deprecated Gradle features is an important issue that should not be ignored, even if it is not the direct cause of the build failure.

Totally agreed.

but it is crucial to consider whether they could be related

Totally agreed.

 they are not

Gradle 9.0 incompatibility is an indicator that something in the project configuration needs attention, regardless of whether it is the direct cause of the current error.

Totally agreed.

Could you clarify?

I already did in the other thread you created.
Probably your messages that were hidden here temporarily triggered the anti-spam automation and were then reviewed by some moderator and are visible again now.