英文:
error: invalid source release: 1.17 whiling using openJDK17 to build
问题
我更新了我的Maven项目的maven.compiler.target
和maven.compiler.source
,从1.8
到1.17
,并且我也升级了我的JDK到openjdk version "17.0.6" 2023-01-17
。
我确认我的Maven版本也正在使用JDK 17,通过运行mvn -v
来验证。
Apache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584)
Maven home: /usr/local/Cellar/maven/3.9.0/libexec
Java version: 17.0.6, vendor: Homebrew, runtime: /usr/local/Cellar/openjdk@17/17.0.6/libexec/openjdk.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "12.6.3", arch: "x86_64", family: "mac"
但我仍然看到这个错误 invalid source release: 1.17
。
有什么我应该检查的吗?
顺便说一句,如果我的maven.compiler.target
和maven.compiler.source
都是1.8
,并且使用JDK17进行编译,我就不会看到这个错误。
谢谢。
英文:
I updated the maven.compiler.target
and maven.compiler.source
of my maven project from both 1.8
to 1.17
and I also updated my JDK to openjdk version "17.0.6" 2023-01-17
.
I confirm my maven version is also using jdk17 by running mvn -v
.
Apache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584)
Maven home: /usr/local/Cellar/maven/3.9.0/libexec
Java version: 17.0.6, vendor: Homebrew, runtime: /usr/local/Cellar/openjdk@17/17.0.6/libexec/openjdk.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "12.6.3", arch: "x86_64", family: "mac"
But I am still seeing this error invalid source release: 1.17
.
Is there anything I should check?
BTW, I do not see this error if my maven.compiler.target
and maven.compiler.source
are both 1.8
while using the JDK17 to compile.
Thank you.
答案1
得分: 3
Java的版本号在1.8版本之后发生了变化。新版本不再带有 1.
前缀。
所以您的版本必须是 17。
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
英文:
The versioning for java has changed after version 1.8. The newer versions are without 1.
So your version must be 17.
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论