简体   繁体   中英

Intellij ignoring Project java source level

Note: this is not a duplicate. This version of spark requires either jdk 1.7 or 1.8. The parent pom.xml entry is shown here:

   <java.version>1.7</java.version>

As shown in the screenshot we have java 1.8 for the SDK and the language level:

在此输入图像描述

And here are the modules settings:

在此输入图像描述

But Intellij is just confused about that:

Error:(73, 51) java: diamond operator is not supported in -source 1.5 (use -source 7 or higher to enable diamond operator)

This is a spark project being built from maven on OS/X. Intellij Ultimate 14.1.4

在此输入图像描述

Update Here is the pom.xml entry for the jdk

If you are using Maven, please watch your pom.xml file. Even if your IntelliJ Project is set to Java 8 your project will compile with the version of Java set in your pom.xml.

Add this to your pom.xml

<properties>
  <maven.compiler.source>1.8</maven.compiler.source>
  <maven.compiler.target>1.8</maven.compiler.target>
</properties>

Or directly in the maven plugin :

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <source>1.8</source> <!-- java version here -->
                <target>1.8</target> <!-- java version here -->
            </configuration>
 </plugin>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM