我正在 IntelliJ 上运行一个 Java Maven 项目,我确保这个项目将由 Java 1.8 编译。
还有项目结构: 我的 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>
当我运行项目时,出现错误:
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。
关于java - 智能 : Fatal error compiling: invalid target release: 1. 8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44231757/