MVN包安装错误javac:目标版本无效:1.8
我正在尝试安装 (我正在运行Ubuntu。)我收到了这个错误MVN包安装错误javac:目标版本无效:1.8,java,git,maven,pom.xml,Java,Git,Maven,Pom.xml,我正在尝试安装 (我正在运行Ubuntu。)我收到了这个错误 [WARNING] The POM for de.jungblut.common:thomasjungblut-common:jar:1.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details [INFO] [INFO] --- maven-clean-plugin:2.5:
[WARNING] The POM for de.jungblut.common:thomasjungblut-common:jar:1.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ glove ---
[INFO] Deleting /home/nat/workspace/Glove/target
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ glove ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 12 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ glove ---
[INFO] Compiling 12 source files to /home/nat/workspace/Glove/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Failure executing javac, but could not parse the error:
javac: invalid target release: 1.8
Usage: javac <options> <source files>
use -help for a list of possible options
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.782s
[INFO] Finished at: Mon Jul 27 14:33:32 EDT 2015
[INFO] Final Memory: 11M/150M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project glove: Compilation failure
[ERROR] Failure executing javac, but could not parse the error:
[ERROR] javac: invalid target release: 1.8
[ERROR] Usage: javac <options> <source files>
[警告]de.jungblut.common:thomasjungblut common:jar:1.0的POM无效,可传递依赖项(如果有)将不可用,请启用调试日志以了解更多详细信息
[信息]
[信息]---maven clean插件:2.5:clean(默认清洁)@glove---
[信息]删除/home/nat/workspace/Glove/target
[信息]
[信息]---maven资源插件:2.3:resources(默认资源)@glove---
[信息]使用“UTF-8”编码复制筛选的资源。
[信息]正在复制12个资源
[信息]
[信息]---maven编译器插件:2.3.2:compile(默认编译)@glove---
[信息]正在将12个源文件编译到/home/nat/workspace/Glove/target/classes
[信息]-------------------------------------------------------------
[错误]编译错误:
[信息]-------------------------------------------------------------
[ERROR]执行javac失败,但无法分析错误:
javac:无效的目标版本:1.8
用法:javac
使用-help获取可能选项的列表
[INFO]1错误
[信息]-------------------------------------------------------------
[信息]------------------------------------------------------------------------
[信息]生成失败
[信息]------------------------------------------------------------------------
[信息]总时间:1.782s
[信息]完成时间:2015年7月27日星期一14:33:32
[信息]最终内存:11M/150M
[信息]------------------------------------------------------------------------
[错误]未能在project glove:编译失败上执行目标org.apache.maven.plugins:maven编译器plugin:2.3.2:compile(默认编译)
[ERROR]执行javac失败,但无法分析错误:
[错误]javac:无效的目标版本:1.8
[错误]用法:javac
我用谷歌搜索了这个,听起来我的Java可能放错地方了?或者POM文件有问题?事实上,我需要将JDK更新为JDK 8。这就是我使用的: $sudo添加apt存储库ppa:webupd8team/java $sudo apt获取更新 $sudo apt get安装oracle-java8-installer 安装之后,我还需要在安装mvn clean package之前添加
sudo
它就像一个符咒。多亏了@Jesper,您很可能安装了比JDK 8更旧的JDK版本。确保已安装JDK 8。请将
JAVA_HOME
指向JDK 8,export JAVA_HOME=/path/to/JDK
谢谢,问题已解决!