英文:
Maven Java error compiling on build: maven-compiler-plugin
问题
当我尝试运行Maven构建时,它总是报BUILD FAILURE
错误。
无法执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) 于项目 testJPA: 编译致命错误:无效的目标版本:11 -> [帮助 1]
我已经尝试了以下操作:
- 删除 .m2 文件夹
- 重新安装 Eclipse
- 在 pom.xml 上设置可执行权限
- 将构建选项设置为 clean
> java -version
java 版本 "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>
以上方法都没有奏效。有什么猜测吗?
英文:
When I try to run as maven build it always give 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]
I already tried the following things:
- remove .m2 folder
- reinstall eclipse
- set executable on pom.xml
- set build option to clean
> 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>
None of them worked. Any guesses?
答案1
得分: 0
我找到了一个解决方案。
我安装了 JDK 11,并在 Window > Preferences > Java > Installed JREs > Add > jdk-11.0.9 进行了设置。
下载链接:https://www.oracle.com/java/technologies/javase-jdk11-downloads.html
英文:
I managed to find a solution.
I installed JDK 11 and set it at Window > Preferences > Java > Installed JREs > Add > jdk-11.0.9
Downloaded at: https://www.oracle.com/java/technologies/javase-jdk11-downloads.html
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论