Eclipse maven | lambda | use -source 8 or higher to enable lambda expressions

1

Java Maven project in Eclipse neon (4.6.0), simply does not compile when using lambda.

The error:

  

use lambda expressions are not supported in -source 1.5 (use -source 8   or higher to enable lambda expressions)

The detail is that I'm using JDK 8:

  Java (TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot (TM) 64-Bit Server VM (build 25.101-b13, mixed mode) >

Eclipse is also configured correctly as shown below:

Any idea why you're giving a lambda error?

    
asked by anonymous 07.09.2016 / 19:34

1 answer

1

The code for your pom.xml should also reference java8. It would look like this:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.0</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>
    
07.09.2016 / 19:36