Hi all,
until Eclipse 2020-03 I executed it with JDK 8, since Eclipse 2020-06 I’m doing so with JDK 11. Reasons are that I need the C+±plugin CDT, which seems to only work with JDK 11, and Eclipse requires JDK 11 for itself with the next release anyway. Besides that, I have still registered JDK 8 as default JRE to be used by Eclipse. Coding in Eclipse itself seems to work as expected, especially I don’t get any errors or warnings about deprecations or missing classes because of changes JDK 8 vs. JDK 11.
The problem is with Buildship: When using the Gradle’s task view to publish some projects, compilation fails with errors which are clearly related to using JDK 11 as well:
C:\Users[…]\jooq\Sequences.java:7: error: package javax.annotation does not exist
import javax.annotation.Generated;
My build.gradle
already contained the following two statements, which don’t seem to have any effect:
sourceCompatibility = 1.8
targetCompatibility = 1.8
Changing those lines to the following didn’t change anything as well:
java
{
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
When publishing the projects on the shell things succeed again, because JDK 8 is still the default JDK of the system. Only Eclipse knows about JDK 11 and I configured the path to use it in eclipse.ini
. What does seem to work as well is configuring the directory where JDK 8 is placed in the Gradle-configs of Eclipse:
Afterwards publishing within Eclipse using Gradle’s task view succeeds again, after removing that config things fail again.
Is that by design? I had expected that I’m configuring the source and target compatibility to prevent exactly those problems. Or what am I doing wrong?
Thanks for your explanations!