错误:java:javacTask:源版本8需要目标版本1.8 [英] Error:java: javacTask: source release 8 requires target release 1.8

查看:1426
本文介绍了错误:java:javacTask:源版本8需要目标版本1.8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用IntelliJ IDE无法编译任何项目。以下设置的屏幕截图:

Using IntelliJ IDE can't compile any projects. Screenshots of settings below:

使用过的JDK:

项目SDK和语言级别:

Project SDK and Language level:

语言水平:

有人有什么想法吗?

推荐答案


  1. 文件>设置>构建,执行,部署>编译器> Java编译器

  2. 目标字节码版本更改为您所在模块的 1.8 为...工作。

  1. File > Settings > Build, Execution, Deployment > Compiler > Java Compiler
  2. Change Target bytecode version to 1.8 of the module that you are working for.

如果你正在使用Maven

将编译器插件添加到 pom.xml 在顶级项目下节点:

Add the compiler plugin to pom.xml under the top-level project node:

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

(从评论中提升。)

注意:如果您不介意重新导入项目,那么您真正需要做的唯一事情是更改pom并重新导入项目,然后IntelliJ将选择正确的设置,您不必手动更改它们。

Note: If you don't mind reimporting your project, then the only thing you really need to do is change the pom and reimport the project, then IntelliJ will pick up the correct settings and you don't have to manually change them.

这篇关于错误:java:javacTask:源版本8需要目标版本1.8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆