Error:(23, 26) java: lambda expressions are not supported in -source 1.5 (use -source 8 or higher to enable lambda expressions)

Viewed 4036

I have added the source target below into pom.xml.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>priv.winnie</groupId>
  <artifactId>newfeature</artifactId>
  <version>1.0-SNAPSHOT</version>

<dependencies>
  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.10</version>
  </dependency>
</dependencies>

  <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>
</project>

I have also changed the Java compiler to 1.8 within IntelliJ. I'm running OpenJDK 1.8.0.

Why it still using Java source level 1.5 to compile code?

2 Answers
Related