3

I am trying to compile a maven project, that is a Java 8 (JDK 1.8) and when I run the following command:

mvn clean compile

The compile throw the following error

Compilation failure [ERROR] /C:/App.java:[16,35] lambda expressions are not supported in -source 1.5 [ERROR] (use -source 8 or higher to enable lambda expressions)

How is it possible? In the command line mvn is set up with JAVA 8 compiler

manolodewiner
  • 504
  • 3
  • 26

1 Answers1

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

Add this plugin configuration to the <project><build><plugins>... section of your pom.xml file

Grzegorz Piwowarek
  • 13,172
  • 8
  • 62
  • 93