Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 430989

Summary: tycho-compiler cannot handle JavaSE-1.8 execution environment
Product: z_Archived Reporter: Fabian Schöppl <spp>
Component: TychoAssignee: Project Inbox <tycho-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: david_williams, jan.sievers, mistria, seifermann, stephan.herrmann, thanh.ha
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Building this bundle via maven reproduces the error shown in this bug
none
Updated pom.xml which uses latest JDT none

Description Fabian Schöppl CLA 2014-03-24 06:50:16 EDT
I am trying to build a Java 8 eclipse plug-in project using tycho 0.20.0. The compilation stops 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]

I run the following pom-file via "mvn clean compile install":

<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>
			</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>

I've attached the MyBundle-eclipse-plug-in (created with Eclipse Luna M6 4.4.0M6) to this bug.

Notes:
According to Mr. Istria this bug is related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=426692. The original tycho-user list communication can be found here: https://dev.eclipse.org/mhonarc/lists/tycho-user/msg05504.html

Thanks,
Comment 1 Fabian Schöppl CLA 2014-03-24 06:51:10 EDT
Created attachment 241164 [details]
Building this bundle via maven reproduces the error shown in this bug
Comment 2 David Williams CLA 2014-03-24 09:12:41 EDT
The "keys" you might be missing are 


<cbi-jdt-repo.url>https://repo.eclipse.org/content/repositories/eclipse-staging/</cbi-jdt-repo.url>
<cbi-jdt-version>3.10.0.v20140316-0146</cbi-jdt-version>

This is a Java 8 capable JDT compiler from an I-build, and it itself will be temporary, but not sure when we'll remove it ... certainly before "Luna release" ... perhaps after M7? 

But if it helps you for now, you are welcome to it. 

If you don't understand how those "fit in" to the whole process/configuration, you can probably figure it out by looking in platform parent pom: 

http://git.eclipse.org/c/platform/eclipse.platform.releng.aggregator.git/tree/eclipse-platform-parent/pom.xml

HTH
Comment 3 David Williams CLA 2014-03-24 09:22:45 EDT
FYI, I opened bug 431014 to help remind me of which "old" versions of the compiler to remove before release ... if timing is critical for you, you might want to follow it, so you'll know when its "going away".
Comment 4 Fabian Schöppl CLA 2014-03-24 09:25:13 EDT
(In reply to David Williams from comment #3)
> FYI, I opened bug 431014 to help remind me of which "old" versions of the
> compiler to remove before release ... if timing is critical for you, you
> might want to follow it, so you'll know when its "going away".

Thank you very much! I am going to follow it.
Comment 5 Jan Sievers CLA 2014-03-24 09:28:23 EDT
the JavaSE-1.8 execution environment was fixed in 0.20.0 already with bug 426692

The error you are seeing is due to JDT compiler not being capable of Java 8 source/target features yet.

JDT compiler update has been requested with bug 430986 so I'm closing this as duplicate.

*** This bug has been marked as a duplicate of bug 430986 ***
Comment 6 Fabian Schöppl CLA 2014-03-24 09:36:51 EDT
(In reply to David Williams from comment #2)
> The "keys" you might be missing are 
> 
> 
> <cbi-jdt-repo.url>https://repo.eclipse.org/content/repositories/eclipse-
> staging/</cbi-jdt-repo.url>
> <cbi-jdt-version>3.10.0.v20140316-0146</cbi-jdt-version>
> 
> This is a Java 8 capable JDT compiler from an I-build, and it itself will be
> temporary, but not sure when we'll remove it ... certainly before "Luna
> release" ... perhaps after M7? 
> 
> But if it helps you for now, you are welcome to it. 
> 
> If you don't understand how those "fit in" to the whole
> process/configuration, you can probably figure it out by looking in platform
> parent pom: 
> 
> http://git.eclipse.org/c/platform/eclipse.platform.releng.aggregator.git/
> tree/eclipse-platform-parent/pom.xml
> 
> HTH

Yes, adding this keys and updating the jdt depenency for the tycho-compiler-plugin does the trick (for now)! I've attached the updated pom.xml file.
Comment 7 Fabian Schöppl CLA 2014-03-24 09:37:17 EDT
Created attachment 241179 [details]
Updated pom.xml which uses latest JDT