Java 7 compile errors in Eclipse when updating from Gradle Xtend plugin version 0.3.6 to 0.4.2

133 views
Skip to first unread message

denis....@gmail.com

unread,
Feb 18, 2015, 8:24:21 AM2/18/15
to xtend...@googlegroups.com
Hi,

when updating an from Gradle plugin version 0.3.6 to 0.2.4 I get a compile error in Eclipse if compiled with JDK 7.
The Gradle build output is:
:clean
:compileXtend
Download https://jcenter.bintray.com/org/xtend/xtend-gradle-lib/0.4.2/xtend-gradle-lib-0.4.2.pom
Download https://jcenter.bintray.com/org/xtend/xtend-gradle-lib/0.4.2/xtend-gradle-lib-0.4.2.jar
the
- javaSourceVersion option is not supported by this Xtend version
But the build task succeeds successfully.

After that, however, the compilation in Eclipse shows up errors at Xtend generated Java code for Java 8 imports. Here is an example
import java.util.function.Consumer;
The error is "The import can not be resolved".

I assume, the Gradle build is running with JDK 8 letting Xtend generate Java 8 code. However, my Eclipse project is compiling against JDK 7.

Is there any way to tell the Gradle plugin letting Xtend generate Java 5/6/7 code?

Regards, Denis

P.S.

my Xtend dependencies resolves to Xtend 2.7.3:
dependencies {
    compile
'org.eclipse.xtend:org.eclipse.xtend.lib:2.7.+'
   
...
}



Stefan Oehme

unread,
Feb 19, 2015, 12:11:27 AM2/19/15
to xtend...@googlegroups.com
You have not set a bootclasspath in Gradle and as a result you compile against JDK 8. Either set a bootclasspath on the Java compile task or start gradle with Jdk 7. This has nothing to do with 0.4.2, but is a general problem when cross-compiling for older Java versions.

denis....@gmail.com

unread,
Feb 19, 2015, 2:50:51 AM2/19/15
to xtend...@googlegroups.com
Thanks for the reply.
I guess, you are right. Additionally to the Gradle plugin I updated the JDK 8 as well but forgot it over the weekend...
I will check this and come back.
Denis
Reply all
Reply to author
Forward
0 new messages