Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 379
ShakibaZar Avatar asked Nov 05 '25 18:11

ShakibaZar


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>
like image 75
Naman Avatar answered Nov 07 '25 10:11

Naman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!