Skip to content

Commit

Permalink
420848 - maven-compiler-plugin source/target 1.8 not recognized
Browse files Browse the repository at this point in the history
The jdt component of m2e v1.4 does not import java 1.8 projects correctly into eclipse.
Instead of setting the compiler compliance level to java 1.8, java 1.4 is used.
This patch fixes this issue by adding JavaSE-1.8 to the list of known java runtime environments
and adding java 1.8 (respectively java 8) to the list of known source/target compliance levels.

This contribution complies with http://www.eclipse.org/legal/CoO.php

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=420848
Signed-off-by: Daniel Dietrich <daniel.dietrich@gmx.net>
  • Loading branch information
danieldietrich authored and ifedorenko committed Nov 5, 2013
1 parent 986cb6d commit 84d401b
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
30 changes: 30 additions & 0 deletions org.eclipse.m2e.tests/projects/compilerSettings18/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<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>

<parent>
<groupId>org.eclipse.m2e.test</groupId>
<artifactId>m2e-test-parent</artifactId>
<version>1.0.0</version>
</parent>

<groupId>org.eclipse.m2e.projects</groupId>
<artifactId>compilerSettings18</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<description>test project for bug 420848</description>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

package org.eclipse.m2e.tests.project;

import org.eclipse.core.resources.IProject;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;

import org.eclipse.m2e.tests.common.AbstractMavenProjectTestCase;


public class CompilerSettings18Test extends AbstractMavenProjectTestCase {

public void testCompilerSettings18() throws Exception {
IProject project = importProject("projects/compilerSettings18/pom.xml");
assertNoErrors(project);
waitForJobsToComplete();

IJavaProject javaProject = JavaCore.create(project);
assertEquals("1.8", javaProject.getOption(JavaCore.COMPILER_SOURCE, true));
assertEquals("1.8", javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true));
}

}

0 comments on commit 84d401b

Please sign in to comment.