maven. lambda expressions are not supported in -source 1.5

后端 未结 3 620
一整个雨季
一整个雨季 2020-11-27 17:29

I use maven to build my project.

I have following configuration:

D:\\freelance\\polyndrom>mvn -verion Apache Maven 3.2.3 (33f8c3e1027c3ffffde9

相关标签:
3条回答
  • 2020-11-27 17:56

    I found possible solution for IntelliJ.

    Go into Project settings (ctrl + shift + alt + s). Then you can change language level into higher version.

    0 讨论(0)
  • 2020-11-27 18:00

    You can specify language version in properties

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
    
    0 讨论(0)
  • 2020-11-27 18:02

    By default, Maven assumes you wrote your code using JDK 1.5 and that you want to compile to that same target. You will need to add the maven-compiler-plugin to your build plugins, in order to tell it to use 1.8.

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

    Check out the plugin's docs for more info: http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html

    0 讨论(0)
提交回复
热议问题