【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>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章