Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] Tycho out-of-the-box support for Java 8

Hello everyone!

I am trying to build a Java 8 eclipse plug-in-project via maven, but the tycho-compiler fails. I've created the plug-in project using the latest Eclipse Luna M6 (4.4.0M6).
The manifest of my simple bundle looks like this:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MyBundle
Bundle-SymbolicName: MyBundle
Bundle-Version: 1.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.8

The pom.xml file looks like this:

<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";>
        <modelVersion>4.0.0</modelVersion>
        <groupId>MyBundle</groupId>
        <artifactId>MyBundle</artifactId>
        <version>1.0.0</version>
        <packaging>eclipse-plugin</packaging>

        <properties>
                <tycho-version>0.20.0</tycho-version>
        </properties>

        <build>

                <plugins>

                        <plugin>
                                <groupId>org.eclipse.tycho</groupId>
                                <artifactId>target-platform-configuration</artifactId>
                                <version>${tycho-version}</version>
                                <configuration>
                                        <pomDependencies>consider</pomDependencies>

                                        <!-- configure the p2 target environments for multi-platform build -->
                                        <environments>
                                                <environment>
                                                        <os>win32</os>
                                                        <ws>win32</ws>
                                                        <arch>x86</arch>
                                                </environment>
                                                <!-- Required if you run tests on a x64 machine -->
                                                <environment>
                                                        <os>win32</os>
                                                        <ws>win32</ws>
                                                        <arch>x86_64</arch>
                                                </environment>
                                        </environments>

                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <version>2.3.2</version>
                                <configuration>
                                        <!--<encoding>UTF-8</encoding> -->
                                        <source>1.8</source>
          <target>1.8</target>
                                </configuration>
                        </plugin>

                        <plugin>
                                <groupId>org.eclipse.tycho</groupId>
                                <artifactId>tycho-maven-plugin</artifactId>
                                <version>${tycho-version}</version>
                                <extensions>true</extensions>
                                <configuration>
                                        <encoding>UTF-8</encoding>
                                        <source>1.8</source>
                                        <target>1.8</target>
                                </configuration>
                        </plugin>

                        <plugin>
                                <groupId>org.eclipse.tycho</groupId>
                                <artifactId>tycho-compiler-plugin</artifactId>
        <version>${tycho-version}</version>
        <!-- uncommenting the following block results in a cannot-resolve-dependency error -->
        <!--
                                 <dependencies>
                                         <dependency>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>org.eclipse.jdt.core</artifactId>
          <version>3.9.2.v20140119-0104_BETA_JAVA8</version>
        </dependency>
        <dependency>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>org.eclipse.jdt.compiler.apt</artifactId>
          <version>1.0.600.v20140119-0104_BETA_JAVA8</version>
        </dependency>
                                  </dependencies>
        -->
                        </plugin>

                        <plugin>
                                <groupId>org.eclipse.tycho</groupId>
                                <artifactId>tycho-source-plugin</artifactId>
                                <version>${tycho-version}</version>
                                <executions>
                                        <execution>
                                                <id>plugin-source</id>
                                                <goals>
                                                        <goal>plugin-source</goal>
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>

                </plugins>

        </build>

</project>

If I run "mvn clean compile install" it will fail with the following error message:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.20.0:compile (default-compile) on project MyBundle: Fatal error compiling: target level should be comprised in between '1.1' an
d '1.7' (or '5', '5.0', ..., '7' or '7.0') or cldc1.1: 1.8 -> [Help 1]

Also, if I change the execution environment to 1.7 (both in the MANIFEST and the pom file) it cannot compile Java 8 features like lambdas.
Do you know which version of tycho is going to support the Java 8 features out-of-the-box (not using BETA_JAVA8 plugins anymore) and when this version is going online?

To workaround the problems shown above, I've also been trying to use the maven configuration suggested in this post http://dev.eclipse.org/mhonarc/lists/tycho-user/msg05279.html. I am afraid that I cannot find the latest BETA_JAVA8 dependencies of org.eclipse.tycho:org.eclipse.jdt.core and org.eclipes.tycho:org.eclipse.jdt.compiler.apt. Could someone tell me where I can get those dependencies?

Yours sincerely,
Fabian







Back to the top