I am trying to build a project using maven, and I am getting this error "diamond operator is not supported in -source 1.6"
I have Java 8 installed and I don't even have Java 6 installed. Please help me.
Thank you.
I am trying to build a project using maven, and I am getting this error "diamond operator is not supported in -source 1.6"
I have Java 8 installed and I don't even have Java 6 installed. Please help me.
Thank you.
In maven, there are two ways to set the compiler source and target.
The 1st way is by setting defining those properties values :
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
The 2nd way is to define the source and the target in the compiler plugin configuration :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
And last but not least, make sure that your IDE (Eclipse, Intellij, etc) is properly configured to use Java 8.
You must tell maven in the pom.xml which versionof java to compile to. Specify it like this :
<project>
[...]
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
[...]
</project>
See https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html for more information.