一:问题
今天编译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. m_atoi

    自己实现atoi函数 函数定义:将字符串转换成整型数:atoi()会扫描参数nptr字符串,跳过前面的空格字符,直到遇上数字或正负号才开始做转换,而再遇到非数字或字符串时('\0')才结束转化,并将结 ...

  2. SPOJ LCS Longest Common Substring 和 LG3804 【模板】后缀自动机

    Longest Common Substring 给两个串A和B,求这两个串的最长公共子串. no more than 250000 分析 参照OI wiki. 给定两个字符串 S 和 T ,求出最长 ...

  3. 如何学好java?

    忻州seo:如何学好java?想必对于任何一个在学习java的朋友们,都会在学习过程中遇到一些问题.例如:Java反射机制是什么?小编也是学习java编程的,现在给大家简单介绍一下:Java反射机制就 ...

  4. 2019杭电多校第七场 HDU - 6656 Kejin Player——概率&&期望

    题意 总共有 $n$ 层楼,在第 $i$ 层花费 $a_i$ 的代价,有 $pi$ 的概率到 $i+1$ 层,否则到 $x_i$($x_i \leq 1$) 层.接下来有 $q$ 次询问,每次询问 $ ...

  5. 30、[源码]-AOP原理-注册AnnotationAwareAspectJAutoProxyCreavi

    30.[源码]-AOP原理-注册AnnotationAwareAspectJAutoProxyCreavi

  6. Codeforces Round #555 (Div. 3) C1,C2【补题】

    D1:思路:L,R指针移动,每次选最小的即可. #include<bits/stdc++.h> using namespace std; #define int long long #de ...

  7. HTML div块内剧中

    在HTML中有一个块内元素剧中的方法   那就是margin:0 auto; 剧中前 剧中后

  8. ckeditor复制粘贴word

    从word文档中直接粘贴到ckeditor编辑区,查看的时候格式会显示混乱,非常难看.解决方法:   CKEDITOR.cleanWord = function(h, i) { return h; i ...

  9. 初步学习MySQL

    我们之前学习如何安装MySQL数据库 以及 navicat 管理数据库可视化工具 那么现在主要来学习一下如何使用,(操作数据库有很多方式,终端操作.可视化工具操作.编程语句操作) 我们首先学习在终端操 ...

  10. webpack4温习总结

    webpack是一个模块打包器,可以根据入口文件,随着依赖关系将所有文件打包成js文件. 首先需要node环境,百度一下自己安装 webpack官网地址:https://www.webpackjs.c ...