当前位置: 代码迷 >> java >> MVN软件包安装错误Javac:无效的目标版本:1.8
  详细解决方案

MVN软件包安装错误Javac:无效的目标版本:1.8

热度:104   发布时间:2023-08-02 11:21:29.0

我正在尝试安装 。

(我正在运行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: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>

我已经用过Google,并且听起来我的Java可能位于错误的位置? 那个或POM文件有问题?

实际上,我需要将JDK更新为JDK8。这就是我使用的方法:

$ sudo add-apt-repository ppa:webupd8team / java

$ sudo apt-get更新

$ sudo apt-get install oracle-java8-installer

安装完成后,我还需要在mvn clean package install之前添加sudo

它像魅力一样运作。 感谢@Jesper

  相关解决方案