如何通过pom.xml告诉编译器使用openjdk 11 [英] How to tell compiler to use openjdk 11 via pom.xml
本文介绍了如何通过pom.xml告诉编译器使用openjdk 11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在pom文件中配置OpenJDK 11.
How to configure OpenJDK 11 in pom file.
<properties>
<maven.compiler.plugin.version>3.8.0</maven.compiler.plugin.version>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
</properties>
推荐答案
问题可能出在您用来运行Maven 的Java版本中.参见此处的讨论:
The problem is probably in the version of Java you're using to run Maven. See the discussion here:
无法编译简单的Java 10/带有Maven的Java 11项目
如果要使Maven识别目标版本为10或11,则必须首先使用Java 11运行Maven.通过执行 mvn --version
.
If you want to make Maven recognize a target release of 10 or 11, you have to first run Maven with Java 11. Check that the Java that Maven is using is correct by doing mvn --version
.
这篇关于如何通过pom.xml告诉编译器使用openjdk 11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文