Eclipse中Maven编译错误:不再支持源选项 5。请使用 6 或更高版本(已解决)
maven
Maven: Apache Maven是一个开源的项目管理和构建工具,主要用于Java项目。适合需要自动化项目构建和依赖管理的开发者。特点包括约定优于配置、易于使用和社区驱动。
项目地址:https://gitcode.com/gh_mirrors/ma/maven

·
错误信息
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] 不再支持源选项 5。请使用 6 或更高版本。
[ERROR] 不再支持目标选项 1.5。请使用 1.6 或更高版本。
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.589 s
[INFO] Finished at: 2019-05-04T20:53:45+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project test: Compilation failure: Compilation failure:
[ERROR] 不再支持源选项 5。请使用 6 或更高版本。
[ERROR] 不再支持目标选项 1.5。请使用 1.6 或更高版本。
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
解决办法:
在pom.xml中添加以下配置语句。(我使用1.8版本的JDK,编译版本也是1.8)
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
问题解决之后,我又配置11.0的JDK进行测试,
还是上面的配置语句,只是换了JDK的版本,依然是打包成功;
(还没弄明白具体原因,有知道的可以告诉我,嘻嘻!)




Maven: Apache Maven是一个开源的项目管理和构建工具,主要用于Java项目。适合需要自动化项目构建和依赖管理的开发者。特点包括约定优于配置、易于使用和社区驱动。
最近提交(Master分支:6 个月前 )
79344392
There was overlapping concerns, so better to separate them. Also, this now allows to use tool with other maven that the one being tested, so result should not be affected.
Also contains fix for ExecutorTool implementation to enforce that process do produce output, as under some circumstances (on Windows) the process may exit with 0 exit code (no error) but produce empty output
on standard output, which should not be possible. 15 小时前
757b5476
* Bump org.apache.maven:maven-parent from 43 to 44
Bumps [org.apache.maven:maven-parent](https://github.com/apache/maven-parent) from 43 to 44.
- [Release notes](https://github.com/apache/maven-parent/releases)
- [Commits](https://github.com/apache/maven-parent/commits/v44)
---
updated-dependencies:
- dependency-name: org.apache.maven:maven-parent
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* Fix checkstyle
* Update site descriptors
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
Co-authored-by: Slawomir Jaranowski <s.jaranowski@gmail.com> 1 天前
更多推荐
所有评论(0)