-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Gradle has poor handling of Java versions #125819
Comments
See also gradle/gradle#16645 (sadly not much interest/activity over there) See also https://discourse.nixos.org/t/auto-detecting-java-installations/4677 |
I saw those, but if I understand correctly they only apply to compilation and not the Gradle daemon, so they wouldn't help with plugins requiring newer versions of Java (like https://github.com/FabricMC/fabric-loom). |
The line in |
Ah, it seems I misunderstood what you were aiming at. How about overriding the JDK used for your Gradle? Making this more flexible is what I was trying to do in #119444 but that's somewhat stalled. Maybe also worth considering. Happy to take your feedback and/or improvements there. |
I believe this was resolved with #119444 It is now possible to pass I'll go ahead and close this issue, because I believe it is resolved and it is inactive for >6 months. |
Describe the bug
The
gradle
package setsJAVA_HOME
tojdk
, which is Java 8. This means that compilation and Gradle itself will use that version of Java, which is problematic since both projects and Gradle plugins may be using newer versions of Java.To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expect there to be a clear way to handle needed Java versions.
Additional context
There are several workarounds here. Newer versions of Java can be configured as Gradle toolchains, but that doesn't help for plugins, and is somewhat ugly (since toolchains can only be configured via dotfiles or command-line arguments). Alternatively, the Gradle package can be overridden, but this is somewhat ugly and non-trivial with the new Nix CLI.
However, this problem is complicated by the fact that many projects will expect a Java 8 compiler. A solution could be to run Gradle itself with the latest packaged version of Java and to have support for Gradle toolchains to use multiple compiler versions.
Notify maintainers
@lorenzleutgeb
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Maintainer information:
The text was updated successfully, but these errors were encountered: