【发布时间】:2021-02-07 00:42:28
【问题描述】:
当我尝试以 maven build 运行时,它总是给BUILD FAILURE。
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project testJPA: Fatal error compiling: invalid target release: 11 -> [Help 1]
我已经尝试了以下方法:
- 删除 .m2 文件夹
- 重新安装eclipse
- 在 pom.xml 上设置可执行文件
- 将构建选项设置为清理
> java -version
java version "1.8.0_261"
> echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_211
pom.xml
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>11</source>
<target>11</target>
<encoding>UTF-8</encoding>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
他们都没有工作。有什么猜测吗?
【问题讨论】:
-
这可能与 Java 11 有关。您安装了 java 11 吗?看看这个:stackoverflow.com/questions/63154787/…
-
我用结果更新了我的问题
-
我看到很多关于在 pom.xml 中设置版本的建议。您可以将您的 pom.xml 内容添加到问题中吗?
-
“mvn –version”在命令行产生什么?
-
因为我没有
Apache Maven它没有那个命令。