Blog
maven-tycho 0.20.0 and java8 source code
People writing e4/OSGi JavaFX application these days will most likely do it using JavaFX8 and probably they then make use of Java8 language features as well. While the latest milestones of Eclipse 4.4 Luna have Java8 support with it your favorite build tool maven-tycho 0.20.0 for those applications is not yet directly supporting java8 because the compiler packaged with it is from the kepler repositories. Yet e(fx)clipse which is using Java8 syntax itself is able to build so it must be possible and here's a short description how we managed to get it work.
Install fresh version of jdt into your local m2 repo
I'm running the following commands on our hudson to get it recognize a newer jdt-version:
# install jdt-core
wget http://download.eclipse.org/eclipse/updates/4.4-I-builds/I20140512-2000/plugins/org.eclipse.jdt.core_3.10.0.v20140512-1116.jar
mvn install:install-file
-Dpackaging=jar -DgroupId=org.eclipse.tycho
-DartifactId=org.eclipse.jdt.core -Dversion=3.10.0.v20140512-1116
-Dfile=org.eclipse.jdt.core_3.10.0.v20140512-1116.jar
# install jdt-apt
wget http://download.eclipse.org/eclipse/updates/4.4-I-builds/I20140512-2000/plugins/org.eclipse.jdt.compiler.apt_1.1.0.v20140509-1235.jar
mvn install:install-file
-Dpackaging=jar -DgroupId=org.eclipse.tycho
-DartifactId=org.eclipse.jdt.compiler.apt -Dversion=1.1.0.v20140509-1235
-Dfile=org.eclipse.jdt.compiler.apt_1.1.0.v20140509-1235.jar
Force the maven compiler plugin to use the versions you installed to your local maven repo
You need to reconfigure your tycho-compiler-plugin
<!-- ... -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho-version}</version>
<dependencies>
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.10.0.v20140512-1116</version>
</dependency>
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>org.eclipse.jdt.compiler.apt</artifactId>
<version>1.1.0.v20140509-1235</version>
</dependency>
</dependencies>
<configuration>
<encoding>UTF-8</encoding>
<extraClasspathElements>
<extraClasspathElement>
<groupId>com.oracle</groupId>
<artifactId>javafx</artifactId>
<version>8.0.0-SNAPSHOT</version>
<systemPath>${java.home}/lib/jfxswt.jar</systemPath>
<scope>system</scope>
</extraClasspathElement>
</extraClasspathElements>
</configuration>
</plugin>
<!-- ... -->
Now your build is once more happy!