美文网首页
Intellj Idea Maven 默认使用JDK8作为 编译

Intellj Idea Maven 默认使用JDK8作为 编译

作者: _oeo___ | 来源:发表于2018-06-06 22:33 被阅读23次

在Intellj Idea 中Maven指定JDK8 版本

问题:

这段时间发现开发的时候JDK8 不能使用lambda表达式。
并且在idea中指定File->Project Structure->Artifacts->SDK&LanguageLevel都是JDK8 也不能使工程默认使用JDK8编译。

这可能是idea 让maven配置的权重大于IDE的设定

而必须要使用Maven进行指定JDK8
才能改变他的默认编译版本。

结论

修改Maven的 pom.xml :

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

相关文章

网友评论

      本文标题:Intellj Idea Maven 默认使用JDK8作为 编译

      本文链接:https://www.haomeiwen.com/subject/pxoisftx.html