一:问题
今天编译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. [nginx] nginx使用SNI功能的方法

    SNI是什么 在使用TLS的时候,http server希望根据HTTP请求中HOST的不同,来决定使用不同的证书. SNI细节 由于HTTP的HOST字段在HTTP GET中.而TLS的握手以及证书 ...

  2. Bash基础——Shell脚本内部常用环境变量

    $@和$*区别 不加引号的时候没区别 #! /usr/bin/bash function print_args_at { printf "%s\n" $@ echo $@ } fu ...

  3. 【问题】root账号的UID和GID永远是0吗?

    参考:Does the root account always have UID/GID 0? 这实际上是2个问题 Does the superuser account always have uid ...

  4. mr-robot靶机练习

    在业余时间进行的靶机练习,也是根据网上的大牛做下来的,重复造轮子吧,但是个人感觉还是即使是造轮子也是需要自己动手呀,毕竟每个人做的过程中遇到的问题是不一样的,这样既可以帮助别人也能锻炼自己.希望可以帮 ...

  5. Windows10安装MongoDB4.0详细流程及启动配置

    一.安装 首先去官网下载Mongodb安装包,网址https://www.mongodb.com/download-center/community,下载完成后双击安装就行 安装步骤: 1.点击nex ...

  6. 纯js验证码

    纯js验证码 <!DOCTYPE html> <html> <head> <title>纯js验证码</title> </head&g ...

  7. /tmp/supervisor.sock no such file 报错

    背景: 在执行 supervisorctl 时,报了这么一个错(如图),查找对应文档后解决,记录下来用来以后遇到使用 解决: 1. 将 supervisord.conf 文件下对应的 /tmp  目录 ...

  8. 51 arm x86 的大小端记录

    51 是大端模式 arm的cortex m 默认小端,可以设置大端 x86是小端 大端模式:低位字节存在高地址上,高位字节存在低地址上  小端模式:高位字节存在高地址上,低位字节存在低地址上

  9. Vue中使用markdown

    markdown 是什么?? 1) 使用marked解析markdown文字 这个就只是解析markdown文字,并不能编辑,倒是可以从数据库中读取markdown文字进行解析,另外代码高亮还要另外解 ...

  10. 系统空闲时间 解决 GetLastInputInfo 负数问题

    using System;using System.Collections.Generic;using System.Linq;using System.Runtime.InteropServices ...