This cropped up when trying to import a Gradle 2.11-rc-1 project into IntelliJ, so I raised it as an issue with JetBrains. The basic error looks like this:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':ideaModule'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
...
Caused by: java.lang.IllegalArgumentException: No enum constant org.gradle.api.JavaVersion.1.6
at org.gradle.plugins.ide.idea.IdeaPlugin.getMaxJavaModuleCompatibilityVersionFor(IdeaPlugin.groovy:116)
at org.gradle.plugins.ide.idea.IdeaPlugin$_configureIdeaProject_closure3$_closure10.doCall(IdeaPlugin.groovy:95)
at org.gradle.api.internal.ConventionAwareHelper$1.getValue(ConventionAwareHelper.java:72)
at org.gradle.api.internal.ConventionAwareHelper$MappedPropertyImpl.getValue(ConventionAwareHelper.java:136)
at org.gradle.api.internal.ConventionAwareHelper.getConventionValue(ConventionAwareHelper.java:114)
at org.gradle.plugins.ide.idea.model.IdeaProject_Decorated.getLanguageLevel(Unknown Source)
at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.getProperty(BeanDynamicObject.java:166)
at org.gradle.api.internal.BeanDynamicObject.getProperty(BeanDynamicObject.java:109)
at org.gradle.api.internal.CompositeDynamicObject.getProperty(CompositeDynamicObject.java:81)
I’ve selectively removed some parts of the stacktrace. The IntelliJ import has the same error, but a different stacktrace. I’m wondering whether something changed in the Tooling API.
The source of the problem seems to be having the sourceCompatibility
and targetCompatibility
properties in gradle.properties rather than directly in the build file. If I move them to the build file, everything works fine.
Note that I’m not seeing this problem with either Gradle 2.10 or 2.8.