diamond operator is not supported in -source 1.5 even when compiler version is 1.8

Viewed 8739

When packaging my project using maven in intellij idea, it gives below error, also my java compiler version is set on 1.8: diamond operator is not supported in -source 1.5 [ERROR] (use -source 7 or higher to enable diamond operator) I'm really confused, because both java version and compiler version are set with 1.8.

1 Answers

Include the following within your <build> tag of your pom.xml to configure maven to compile with source and target with Java 1.8 :

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