2

I am using Java 1.8(which is set in all env variables. Also I dont not have any other version installed.)

Still when I am doing a maven build on a project, its giving me the below error: "diamond operator is not supported in -source 1.6 (use -source 7 or higher to enable diamond operator)"

Please suggest.

kps
  • 163
  • 3
  • 12
  • Maven finds the java version from JAVA_HOME parameter. You can also go to `mvn` (non-windows)/ `mvn.bat` (windows) and set the java version explicitly. Can you check what are the values set for both of these? – Kishore Bandi Mar 03 '16 at 06:45
  • mvn -v Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T22:59:23+05:30) Maven home: C:\Program Files\apache-maven-3.2.5 Java version: 1.8.0_73, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.8.0_73\jre – kps Mar 03 '16 at 07:42
  • 1
    Can you include `maven-compiler-plugin`? Kindly refer to [http://stackoverflow.com/a/16723563/1925997](answer) on how to include it in pom.xml. You can also, specify the properties 1.8 and 1.8. This should fix the issue. – Kishore Bandi Mar 03 '16 at 07:54
  • That's right..It did :) – kps Mar 07 '16 at 07:41

1 Answers1

0

Have you tried doing this:

           <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                </configuration>
            </plugin>

Where maven.compiler.source and target is 1.8

Prashant
  • 4,775
  • 3
  • 28
  • 47