java - 智能 : Fatal error compiling: invalid target release: 1. 8

标签 java intellij-idea java-8 java-runtime-compiler

我正在 IntelliJ 上运行一个 Java Maven 项目,我确保这个项目将由 Java 1.8 编译。

我在运行/调试配置中将 JRE 设置为版本 8 enter image description here

还有项目结构: enter image description here 我的 pom.xml 文件还包含 java 版本 8,如下所示:

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

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

我还将 Java 编译器选项设置为 1.8 版。 enter image description here

当我运行项目时,出现错误:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project feed_matcher: Fatal error compiling: invalid target release: 1.8 -> [Help 1]

你知道如何解决这个问题吗?

P.S 我点击了这个链接:IDEA: javac: source release 1.7 requires target release 1.7我仍然无法解决问题。

最佳答案

我假设您希望在版本 8 中使用它,尽管有很多评论告诉您设置为 7。

您可能错过了 maven runner 的设置,它位于 Preferences -> Build, Exection, Deployment > Build Tools > Maven > Runner 下,参见附图。您还需要将其设置为 Java 8。 config screenshot

关于java - 智能 : Fatal error compiling: invalid target release: 1. 8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44231757/

相关文章:

java.time.ZonedDateTime.parse 和 iso8601?

java - 使用可变参数计数的 FunctionalInterface 实现

java - 构造函数引用和调用构造函数的 lambda 表达式有什么区别?

java - GC 和在 for 循环中赋值

java - 排序前删除所有空数组值

java - IDE 和编译器对/t 间距有不同的间距吗? (IntelliJ 上的 JAVA)

java - 无法启动 IntelliJ (2017.2.2)

java - 广播接收器不起作用

java - 推土机给我异常(exception)

jsp - Spring Web MVC在intellij中无法访问jsp文件