[GRADLE-2668] Strange behaviour of IdeaProject.languageLevel Created: 01/Feb/13 Updated: 02/Feb/17 Resolved: 02/Feb/17 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | ||
Reporter: | Gradle Forums | Assignee: | Unassigned |
Resolution: | Won't Fix | Votes: | 0 |
Description |
Assume that I have simple flat multi module (java) project where I specify `sourceCompatibility` and `targetCompatibility` on the subprojects. Here is what I have noticed: `IdeaProject.jdkName` is always set properly according to `targetCompatibility` but `IdeaProject.languageLevel` does not. That is, `languageLevel` is only set properly if I apply the 'java' and the 'idea' (in this order) plugins on the root project. This is undesirable because the root project should not be a 'java' project. I expect the `languageLevel` to behave the same way as `jdkName`. Of course, it is always possible to set these properties manually, the code below works properly: // Applied on the root build script *EDIT*: I'm accessing these properties through the Tooling API. |
Comments |
Comment by Gradle Forums [ 01/Feb/13 ] |
`jdkName` is set based on the JDK version used to execute Gradle, making the reasonable assumption that most people will want to use the same JDK version in IDEA. `languageLevel` is currently hardcoded to 1.6, except when the root project has the `java` plugin applied, in which case `project.sourceCompatibility` is used. I agree that this is far from perfect. A much better default would be to take the maximum source compatibility found in any subproject. (In IDEA this is a per-project setting, or in other words a per-Gradle-build setting.) I'll open an issue to track this. |
Comment by Attila Kelemen [ 02/Feb/13 ] |
If it is addressed sometime in the future, may I propose the following:
This would make it possible to use different versions of Java per project (though I don't know if anyone needs this). Also, one less reason to use the idea plugin in the script. |
Comment by Benjamin Muschko [ 15/Nov/16 ] |
As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub. We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to. Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:
We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle! |
Comment by Benjamin Muschko [ 02/Feb/17 ] |
I believe this issue has been fixed (at least partially) by the following:
Please open an issue on GitHub if you think further work needs to be done. |