Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is IntelliJ IDEA's Gradle language level determined?

The JetGradle plugin that comes with IntelliJ shows my project as having a conflict. It says that my IDE language level is 1.7 and that my Gradle language level is 1.6.

The following code prints 1.7 for everything:

compileJava {
    println project.sourceCompatibility
    println project.targetCompatibility
    println sourceCompatibility
    println targetCompatibility
}

Running Gradle from the command line works fine. Running it inside of IDEA works as well. Both of these are using the 1.7 JDK. My IDEA project and module are also configured to use 1.7.

When I import the project via the Gradle build script, the version does default to 1.6. I have changed it to 1.7.

What is this "Gradle language level" and how can I modify it?

Thanks!

like image 567
tnunamak Avatar asked Jan 21 '13 20:01

tnunamak


1 Answers

Gradle does not expose the language level via the tooling api so I would think this is just the "default project" language as defined in intellij.

You can see details, and track back to the corresponding gradle issue, in this jetbrains youtrack ticket

As to "how to fix it", I think the only real option is to not use use jetgradle & use the gradle idea plugin. Intellij 12.1 will have a much improved jetgradle plugin but if the info is not on the tooling api then it's difficult to see how this can be fixed.

EDIT: Gradle have just published an RC for 2.11 which (finally!) includes this feature, see the release notes for details which explains that this support is there for both the tooling api (i.e. intellij jetgradle) and the gradle idea plugin.

like image 186
Matt Avatar answered Dec 11 '22 22:12

Matt