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
Java 11 support #5120
Comments
For the record, the bug report is: |
@blindpirate Do we have a link to that bug report? |
@marcphilipp I updated my content. |
Thanks! So, does this mean we can still change environment variables using a reflection (causing a warning) but we know of at least one place were those changes are not taken into account anymore (converting |
@marcphilipp Exactly. |
Java 11 entered ramp-down mode and it's important to start testing against it to ensure bugs are fixed before the release. I tried to build Kafka (which uses Gradle) with Java 11 and ran into this issue. Is there a workaround? |
@ijuma There're 3 issues listed, which one do you mean? For the first one, we've already upgrade to ASM 6.2 in #5802, you can either use a nighty http://services.gradle.org/distributions-snapshots/ or keep using For the issue 2/3, |
Thanks for the helpful responses. Will try with |
Btw, even with
|
@blindpirate was there anything decided w.r.t. env vars ? This is affecting us in elastic/elasticsearch#31399 where we require |
@atorok We're doing this right now. A new daemon should be used in this scenario. |
I don't think starting a new daemon is the right way here. It's a last-ditch option, but environment variables change very frequently and starting a new daemon every time would be catastrophic for performance. We should create a document with a couple of alternative solutions before diving into implementation for that. |
@oehme maybe at least provide the ability for the build script to say which are the env vars that matter ? Or provide an option to configure if a new daemon is started or not, so build script that don't need env vars can benefit from performance, for the ones that do need them performance won't matter as functionality will be broken in a confusing way, i.m.h.o. that tops performance. |
You're assuming there are no better options, like:
|
Here's the latest list of failures: https://builds.gradle.org/viewLog.html?buildId=15723921&tab=queuedBuildOverviewTab |
Java 11 is now generally available. |
After the upgrade to Groovy 2.5.2, compilation of build scripts now fails with error messages like this:
According to https://issues.apache.org/jira/browse/GROOVY-8727 this should be fixed in Groovy 2.5.3 which should be released "this or next week". |
Scala can be upgraded to 2.11.12 to support |
MacOS Gradle4.10.2 Java11 not supported: Could not determine java version from '11'. |
@lsaint From the stacktrace you posted, it doesn't look like |
@lsaint Please update the version in your gradle-wrapper.properties. It doesn't matter what you have installed on your system when using the wrapper. The wrapper will use what's specified in the wrapper.properties. |
@lsaint @oehme I see no problem. I build Vavr v1.0 with Gradle 4.10.2 and Java 11, both on a Mac and on Linux. My Travis CI builds even run with JDK12 (ea). |
@danieldietrich Yes, there are only some minor corner cases that don't work. Overall Java 11 support is pretty solid already. |
With java 11, it works editing (gradle/wrapper/gradle-wrapper.properties): |
@danieldietrich Vavr seems to be using Maven, and not Gradle (I see a |
Do you want an example of a Gradle build that uses modules in its build (e.g., its I only see the latter in Vavr v1.0.0. If you want the former, I modified Gradle’s experimental JPMS support plugin. My plugin name isn’t finalized, but it’s currently available as There are a few issues with Gradle 5.0-rc-1, but in general, it works with 4.10.2. There are a few issues with Currently, you just apply the plugin, and, in standard cases, if you have a It currently doesn’t have any configuration other than applying the plugin, but, in the future, I’ll add a DSL for manually configuring JPMS options, and for overriding the plugin’s auto JPMS setup. In the meantime, you can add manual JPMS options as task string options, or you can let me know where my auto config doesn’t work for you, and maybe I can improve it to avoid manual option setup. If you want to look at the code whose binary is deployed on the plugin portal, you need to look at the |
^^^ that. I managed to create a Java 9 modularized project that builds with Gradle. As I mentioned in vavr-io/vavr#2316, the Gradle official modularization example uses a very convoluted project to demonstrate a complex idea like JPMS, and ends up deviating from the point. The lack of official JPMS support is also surprising, considering Java 11 is GA now, and 8 EOL, so anyone caring about their system should upgrade to 9+. Clearly, Gradle is far from ready to embrace JPMS. Thanks for forking the jigsaw plugin, but for obvious reasons, I don't want to use something like that in production code. I'll be evaluating a migration strategy for our projects, and whether it is worth undertaking the modularization effort. |
Using JPMS is not required for using Java 9+. You can run with the classpath just as before. Before you give yourself the trouble of using the JPMS, ask yourself what you need it for. If you don't have a very strong reason (and most projects I've seen don't), I'd stay away from it. Note that this issue is not about JPMS support, only about running Gradle on Java 11, so please keep on topic :) |
That’s like saying the postal workers who deliver Christmas presents to Afghanistan are war veterans :) If we simply wanted to compile code, why Gradle, a shell script would do that. “Running” on Java 11 means being able to build a project on Java 11, with whatever features Java 11 supports. Whether people need JPMS or not is their business; that doesn’t hide the fact that Gradle is not Java 9+ compatible. |
Java 11 would be a LTS (long time support) version. For now, it's still a bit earlier to invest our time into it, since it's still not stable and lack of ecosystem. Some issues I've identified include:
ASM throwsIllegalArgumentException
upon Java 11 bytecode.object java.lang.Object in compiler mirror not found.
File.getAbsolutePath()
isn't affected bySystem.setProperty("user.dir", "")
and daemon needs correct behavior to set environment.has different behavior on Java 10 and Java 11.
according to JDK team: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8202127
In #2159 , the environment manipulation was disabled for Java 9+. At that point, JDK team promised to disable reflection access in Java 9 - which didn't happen eventually. On Java 9/10/11, illegal reflection access is actually allowed with an warning. This means that we can use reflection to set environment variable as before - and the warning can be suppressed by putting Gradle jars on
--module-path
then adding--add-opens java.base/java.util=<GRADLE>
. However, this doesn't mean we should - we shouldn't keep using this dirty hack to set environment since the first day of Gradle. We need another discussion on how to solve this issue.The text was updated successfully, but these errors were encountered: