Eclipse 4.3.2 with Java 8 patches doesn't recognize source level 1.8

女生的网名这么多〃 提交于 2019-12-07 03:30:40

问题


I'm using Eclipse 4.3.2 with the patches for Java 8 from, along with m2e and Subclipse, completely updated to the latest versions of everything.

I went into the Maven POMs for our project and changed the maven-compiler-plugin to:

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
    <source>1.8</source>
    <target>1.8</target>

I updated all my Maven projects tried to do a complete clean and build. Errors all over the place. Ignoring the internal compiler error for the moment, the error I see most is:

Syntax error, static imports are only available if source level is 1.5 or greater

I'm running Java 1.8---why am I getting this message? Is m2e to blame? The maven-compiler-plugin? Or is Eclipse Java 1.8 support simply not ready for prime time?


回答1:


If you don't want to use an early 1.5 milestone, please note that m2e 1.4.1 ALSO supports Java 8, and you can install it from this update site:

http://download.eclipse.org/technology/m2e/releases/1.4/1.4.1.20140328-1905

It's also on the Eclipse Marketplace:

https://marketplace.eclipse.org/content/java%E2%84%A2-8-support-m2e-eclipse-kepler

And if you happen to be a fan of JBoss Tools, it's coming directly to JBoss Central:

https://issues.jboss.org/browse/JBIDE-17002




回答2:


Apparently m2e doesn't yet support Java 8.

According to Eclipse Bug 420848, you have to install m2e 1.5 M6 from the http://download.eclipse.org/technology/m2e/milestones/1.5 software site. I did this and the source level 1.5 errors went away.



来源:https://stackoverflow.com/questions/22696067/eclipse-4-3-2-with-java-8-patches-doesnt-recognize-source-level-1-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!