IntelliJ:错误:Java:不支持版本10 [英] IntelliJ: Error: java: release version 10 not supported
问题描述
在IntelliJ中,当我尝试从构建菜单进行构建时,我得到了一条奇怪的错误消息
In IntelliJ, I'm getting this strange error message when I try to build from the build menu
错误:java:不支持10版发行版
Error: java: release version 10 not supported
我不明白,因为在项目结构中,我设置了以下设置:
I don't understand this, since in Project Structure, I have these settings set:
Project SDK:9.0
项目语言级别:SDK默认
模块语言级别:项目默认值(两个模块)
Project SDK: 9.0
Project Language Level: SDK Default
Module Language Level: Project Default (both modules)
在我的pom.xml文件中,两个模块中都设置了以下属性:
In my pom.xml files, I have these properties set in both modules:
<maven.compiler.source>9</maven.compiler.source>
<maven.compiler.target>9</maven.compiler.target>
我不知道为什么要尝试将JDK 10用于任何东西,但我仍然收到该消息.
I have no idea why it's trying to use JDK 10 for anything, but I still get that message.
我很高兴使用JDK 10,但是我的项目在该版本中不起作用,所以我回头看看它在哪个版本中工作.我已经安装了版本1.4到版本10的SDK.
I'd be happy to use JDK 10, but my project doesn't work in that version, so I'm going back to see which versions it works in. I have SDKs installed for version 1.4 through 10.
我也尝试过使用JDK 1.8进行构建,但是得到的错误消息略有不同:
I've also tried building using JDK 1.8, but I get a slightly different error message:
错误:java:无效的目标版本:10
Error: java: invalid target release: 10
我发现我可以使用JDK 9在命令行中进行构建,但是我需要从我的IDE中进行构建.
I've found that I can build from the command line using JDK 9, but I need to build from my IDE.
有人可以告诉我如何使用JDK 1.9或1.8来构建我的项目吗?
Can anyone tell me how to build my project using JDK 1.9 or 1.8?
推荐答案
我刚刚弄清楚了.我还需要调整Maven-compiler-plugin中的版本.我正在使用3.8.0版.我需要更改此值:
I just figured it out. I also needed to adjust the version in the maven-compiler-plugin. I'm using version 3.8.0. I needed to change this value:
<release>10</release>
在这里找到它:
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>10</release> <!-- This was the problem. -->
</configuration>
...
这篇关于IntelliJ:错误:Java:不支持版本10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!