一:问题
今天编译maven 项目构建失败,提示内容如下:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project xxx: Fatal error compiling: 无效的目标发行版: 1.8 -> [Help 1]

二:解决方案
网上查了一下,大概知道了是编译配置的原因,版本不匹配。相关的pom文件配置部分如下:
<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <source>1.8</source>
    <target>1.8</target>
  </configuration>
</plugin>
需要的版本是1.8而我本地的jdk版本是:

java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

所以就去下载了下jdk1.8版本,然后更新~/.bash_profile中的配置(MAC机),java -version 输出信息:

OK ,So easy, 再重新回到IDEA,编译项目,然而问题居然没有解决!!

三:遇到的坑

问题依旧,然后我就以为是IDEA的配置问题,各种更新配置,搞得我都要尝试把版本写入配置文件的那种方法(百度可查到)了~

这时,我忽然发现了一个问题,IDEA的终端里,输出的JDK版本信息依旧没有更新:

Oh, my god! 什么情况,我再重新打开终端,发现输出的版本信息居然还是1.7的,难道是~/.bash_profile中文件的配置,只对当前终端生效??

这时,我发现了问题的所在,因为我的mac的终端并没有使用bash,而是装了zsh(相信眼尖的小伙伴在上个截图就看到了),所以我在第二步骤修改的,不应该是~/.bash_profile,而是,~/.zshrc,

然后更新生效,问题解决。

四:总结

1. 遇到这个问题,首先应该了解,是JDK版本的问题,先检查IDEA或其他IDE配置的项目JDK版本,如果是本机的版本,更新。

2. 如果安装了zsh或其他的一些shell,记得修改相应的文件,不要修改错误。

3. IDEA的Terminal在更新完配置后,需要关了重启,才更新。

4. 第一次写东西,内容格式多包涵,码字不易。这个问题,需要的坑大神小神,可能都不会遇到,各家的情况都不一样,仅供参考,不喜勿喷。

问题:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile)的更多相关文章

  1. maven install Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project web_nanchang

    maven打包成war时,报错:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default- ...

  2. Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (dist) on project hadoop-kms: An Ant BuildException has occured

    编译cdh版hadoop2.5.0出现的问题 系统: CentOs66 64位 JDK:1.7 Maven: 3.0.5 Protobuf: libprotoc 2.5.0 编译命令: mvn pac ...

  3. Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project LogTest: Compilation failure -> [Help 1]

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default ...

  4. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:

    security-sdk-1.0.jar已经存在于D:/secServerSDK-test/src/main/resources/lib下 报错如下: xxxxxx@xxxxxxxx /d/secSe ...

  5. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create (default-cli) on project standalone-pom: Unable to parse configuration of 3: mojo org.apache.maven.plugins:

    问题: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create (defau ...

  6. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on ...

  7. maven install 报错Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project*****

    [ERROR]Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-co ...

  8. Maven Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean Failed to delete access_log

    I'm trying to run simple struts project using maven and tomcat. When I'm trying to exucute next goal ...

  9. 解决Failed to execute goal org.apache.maven.plugins

    1.Maven构建失败 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin: 2.3 . 2 :compile  ...

  10. Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 解决办法

    Maven install失败 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (d ...

随机推荐

  1. java - day012 - 异常 , throws, throw , IO ,RandomAccessFile

    异常 封装错误信息的对象 错误信息 类型        例如: NullPointerExce 空指针 提示消息  出错的行号 异常的继承结构 Throwable | - Error 系统级错误 | ...

  2. Windows Server 2008更改SID

    参考:Windows Server 2012 克隆修改SID 前言 克隆(软克隆,硬克隆)虚拟机后,虚拟机不光名称一样,IP一样(设置静态IP情况下),连SID也一样 什么是SID SID 安全标识符 ...

  3. DNS服务——搭建企业内网DNS服务器的作用

    前言 DNS服务——服务端 和 客户端 配置 介绍了如何在DNS安装DNS服务,更改一下配置文件就可以依据根提示解析全球域名.既然使用互联网上的DNS服务器就可以解析全球域名,为何还要自掏腰包搭建DN ...

  4. 从Retrofit的源码来看 HTTP

    关于Retrofit是啥,这里就不多解释了,还是先来瞅下官网: 而这次主要是了解它的底层动作机制,而在了解底层之前先来回顾一下官网的整体使用步骤: 咱们也以官网的这个例子为例,先从简单的使用开始逐步深 ...

  5. Linux添加shell(.sh)脚本并添加定时任务

    一.添加sheel脚本 1.首先创建一个执行程序:vim a.sh 2.编辑: #!/bin/bash  python3  python.py >> test2.log 2>& ...

  6. linux 用户,密码,用户组

    linux 用户,密码,用户组 在root登陆的情况下: 用户密码: useradd <username> passwd <username> <提示输入密码>: ...

  7. 六、用DataContractSerialize类序列化XML

    一.层次结构 基类:XmlObjectSerializer 派生类: DataContractSerializer NetDataContractSerializer DataContractJson ...

  8. vs2017 c# 控制台 输出中文显示问号 ; vs2017 c# 控制台 输出中文显示乱码

    问题: 解决: 在main方法最前面加一句就OK了! Console.OutputEncoding = Encoding.GetEncoding("gbk"); 或者 Consol ...

  9. 银川区域赛现场赛 Pot!!【线段树】

    给定两个操作: MULTIPLY L R x  区间里都乘以一个数x MAX L R : 计算区间内一个2,3,5,7个数最大值. 思路:维护4个最大值.蓝瘦. /** 有 n 个数和 5 种操作 a ...

  10. JSP数据交互(二)

    Application:当前服务器(可以包含多个会话):当服务器启动后就会创建一个application对象,被所有用户共享page.request.session.application四个作用域对 ...