Maven Compilation Error: (use -source 7 or higher to enable diamond operator)

Check how your maven-compiler-plugin is configured, it should use java version 7 or higher:

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

For a more complete answer see the one below.

Leave a Comment