【Java】 Methods references are not supported at language level '5'

【问题描述】

        在IDEA中使用maven时出现了如下错误:

Methods references are not supported at language level '5'

        看到这个问题,我首先想到的可能是我的jdk没有配置成1.8,但是查询之后发现jdk已经配置成了1.8。

【问题原因】

        出现该错误的原因是因为在maven的配置文件中没有指定jdk的版本,需要在pom.xml文件中指定jdk的版本。

【解决办法】

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
发布了253 篇原创文章 · 获赞 1152 · 访问量 50万+

猜你喜欢

转载自blog.csdn.net/gdkyxy2013/article/details/100746279
今日推荐