sagari
sagari

Reputation: 431

enabling the lambda expression

In the program like

entities.stream().filter(m->m.getId()==id).findAny().get();

where entities is a List. After setting all the libraries and other SDKs to Java 8. we are getting the error as:

use -source 8 or higher to enable lambda expressions

Upvotes: 13

Views: 6919

Answers (1)

sagari
sagari

Reputation: 431

This is how solved my problem by adding the below plugin settings in my parent POM file.

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

Upvotes: 30

Related Questions