0
votes

I have a gradle project. sourceCompatibility and targetCompatibility is set to 15. Gradle JDK is set to java 15 and project setting java is set to jdk 15 and language level 13. But when i reimport the project or change any steegins. Java version and language level gets reset to jdk 11 and level 6. I have tryed deleting gradle and .gradle and reimporting still happens. Updated gradle version to 6.7.1 still happens.

Is this gradle or intellij issue and how to fix it?

1
Java version and language level gets reset to jdk 11 and level 6. - wher do you see this? Attach screenshots here as well as your build.gradle file.Andrey
Project settings. I set jdk15 and level 13. Hit apply. Now when i reimport gradle or update build.gradle, these 2 values are set to 11 and 6 under project settings.Marko Taht

1 Answers

0
votes

See how the IDE sets the Gradle JVM and language level in documentation:

  • Gradle JVM: when IntelliJ IDEA opens the Gradle project, it checks the gradle.properties file for the appropriate JVM version specified in org.gradle.java.home and uses it for the project. If it is not specified, then the project SDK is used. Alternatively, you can use the Gradle settings to configure the Gradle JVM.

  • Language level: the language level settings are applied for a source root or for a module. If a Gradle project has a single linked project then the project default language level is set to the minimum language level among the module language levels. The module language level is set to sourceCompatibility in the build.gradle file.

The preview part is set to the conjunction of preview flags of the module source sets. The source set module language level is set to the corresponding combination of sourceCompatibility property and --enable-preview flag.