Unable to compile groovy under Java 1.8.0-ea, Gradle 1.8


(Vladislav Soroka) #1

Unable to compile groovy under Java 1.8.0-ea, Gradle 1.8

build.gradle: sourceCompatibility = 1.8 targetCompatibility = 1.8 dependencies {

compile “org.codehaus.groovy:groovy-all:2.1.8”

compile gradleApi() }

$ java -version java version “1.8.0-ea” Java™ SE Runtime Environment (build 1.8.0-ea-b102) Java HotSpot™ 64-Bit Server VM (build 25.0-b44, mixed mode)

Caused by: org.gradle.api.GradleException: Could not call GroovyCompile.compile() on task ‘:compileGroovy’

at org.gradle.util.JavaMethod.invoke(JavaMethod.java:69)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)

at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:527)

at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:510)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)

… 52 more Caused by: BUG! exception in phase ‘semantic analysis’ in source unit ‘C:\dev\src\other\from_users\GradleJDK8Test\src\main\groovy\sample\MyTask.groovy’ Could not load class ‘sample.Y’ from file: C:/dev/src/other/from_users/GradleJDK8Test/build/classes/main/sample/Y.class.


(Peter Niederwieser) #2

Neither the Groovy compiler nor Gradle itself can currently be run with Java 8 because some of their underlying libraries (notably ASM) don’t support Java 8 yet. If you want to compile against Java 8, you can set ‘compileJava.options.fork = true; compileJava.options.forkOptions.executable = “path/to/javac”’, or ‘compileGroovy.groovyCompileOptions.fork = true; compileGroovy.options.forkOptions.executable = “path/to/javac”’ in case of Java/Groovy joint compilation.