-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running a main()
function in IntelliJ fails when the configuration cache is enabled
#21364
Comments
Sorry that you're having trouble with Gradle! Your issue lacks information about how to reproduce the problem you're having. A reproducer project can really help us track down and fix your problem quicker. We may also be able to suggest workarounds or ways to avoid the problem if we can reproduce it. You can use the following as a base for your reproducer: https://github.com/gradle/gradle-issue-reproducer This issue will be closed after 7 days, unless you can provide more information. |
Unfortunately it's not straightforward for me (legal and stuff) to provide a standalone reproducer project, if the steps are unclear. Please let me know if the steps are sufficient and I can try to get that sorted. |
Hi, @TimvdLippe. Thanks for the report! This happens because IntelliJ is setting up a We are still considering what the best solution for this type of problem might be but, in the meantime, you can mark the offending tasks tasks.withType(JavaExec).configureEach {
if (name.endsWith("main()")) {
notCompatibleWithConfigurationCache("JavaExec created by IntelliJ")
}
} |
@bamboo Can confirm the workaround fixes it for now, thanks for the suggestion 👍 |
…needed with Gradle 8.7 and IntelliJ 2024.1).
This seems to no longer be an issue, at least with Gradle 8.7 and IntelliJ 2024.1. Perhaps it was addressed by https://docs.gradle.org/8.7/release-notes.html#supporting-standard-streams-as-task-property-values. Update: One caveat, I'm still experiencing the bug in IntelliJ 2024.1 where Kotlin |
…onger be needed with Gradle 8.7.
Thanks, @ianbrandt! I can confirm that this was indeed fixed in Gradle 8.7. |
Indeed, IJ's standard init script for
I was confused by the |
Running a
main()
function in IntelliJ with the configuration cache produces cache failures and fails the build.Expected Behavior
Executing a
main()
function in IntelliJ works with the configuration cache.Current Behavior
Running a
main()
function in IntelliJ produces the following configuration cache report:Context
We enabled the configuration cache, but now it breaks when we attempt to run a
main()
method in IntelliJ.Steps to Reproduce
main()
methodmain()
class, either by clicking the play button in the bar on the left, or by right-clicking and click "Runmain()
" in the context menuYour Environment
I wanted to attach the configuration cache report, but since it is a
.html
file I am unable to. This is the full stacktrace in the report:The text was updated successfully, but these errors were encountered: