• 系统:macOS

  • 开发工具:Idea

  • 问题描述:在idea中执行mvn clean install时报No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?报错,打包失败。

  • 问题处理:

    1、按照网上的方法检查了idea的java配置,确认配置的是JDK而不是JRE,检查方法可参考(https://blog.csdn.net/tolcf/article/details/50803414),尝试切换idea的JDK配置问题依然存在,又尝试在系统终端执行 mvn clean install 也报同样的错误;

    No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

    2、只能再次求助百度,偶然找到一篇文章(https://stackoverflow.com/questions/21099072/eclipse-maven-error-no-compiler-is-provided-in-this-environment)从里面得到一点启发尝试执行 mvn help:system 查看了一下系统的各种变量和属性,发现PATH中居然不包含JAVA_HOME路径,以前明明配置过的

    PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:

    但奇怪的是此时执行java -version是居然可以正常获取java版本(此处原因不详),尝试执行了source /etc/profile,再次执行mvn clean install打包成功了!顿时一阵欣喜,然后再次在idea中执行时又失败了!!!

    3、再次查看了一下环境变量,JAVA_HOME又没了!不过现在知道问题原因就好解决了,查看自己的默认shell echo $SHELL,bash 编辑.bash_profile,zsh编辑.zshrc,在最下面添加

    source /etc/profile 编辑保存后不要忘了执行source ~/.zshrc,再次在idea中执行打包命令就成功了!

  • 遗留问题:目前看问题本质就是环境变量失效了,但失效原因不清楚,还有配置/etc/profile时居然不是全局生效了,也很奇怪,暂不深究了,以后慢慢研究

  • 补充知识:

    1、java环境变量配置

    JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/ CLASSPAHT=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar PATH=$JAVA_HOME/bin:$PATH: export JAVA_HOME export CLASSPATH export PATH

    2、查看默认shell

    echo $SHELL

maven打包时报No compiler is provided in this environment处理的更多相关文章

  1. eclipse Maven操作出现No compiler is provided in this environment.Perhaps you are running on a JRE rather than a JDK?

    右键 pom.xml -> Run as -> Maven install 后出现类似如下错误: 解决方法: 1)选择项目后,点击 eclipse 导航栏中 [Window]-->[ ...

  2. 【maven】maven的web项目打包报错:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK

    打包过程中报错如下: No compiler is provided in this environment. Perhaps you are running on a JRE rather than ...

  3. No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? idea maven 打包报错问题解决

    mvn clean install -X -Dmaven.test.skip=true -P dev 打包报错:No compiler is provided in this environment. ...

  4. maven打包错误:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

    [INFO] Scanning for projects...[INFO]                                                                ...

  5. Maven No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 问题

    maven编译项目时出错,提示信息如下: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3 ...

  6. maven No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

    maven install项目时出错,提示信息如下: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-pl ...

  7. Maven异常: No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK解决(能力工场小马哥)

    问题描述: No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JD ...

  8. Maven构建项目出现No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

    No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 你应该 ...

  9. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project triage: Compilation failure [ERROR] No compiler is provided in this environment.

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

随机推荐

  1. windows18.04远程桌面连接ubuntu16.04

    方法1: https://www.cnblogs.com/xuliangxing/p/7642650.html 方法2: 也可以通过在ubuntu上安装samba.

  2. 存算分离下写性能提升10倍以上,EMR Spark引擎是如何做到的?

    ​引言 随着大数据技术架构的演进,存储与计算分离的架构能更好的满足用户对降低数据存储成本,按需调度计算资源的诉求,正在成为越来越多人的选择.相较 HDFS,数据存储在对象存储上可以节约存储成本,但与此 ...

  3. Spring框架之beans源码完全解析

    导读:Spring可以说是Java企业开发里最重要的技术.而Spring两大核心IOC(Inversion of Control控制反转)和AOP(Aspect Oriented Programmin ...

  4. 计算机二级考试:Java

    目录 第 1 章 Java 语言概论 第 2 章 基本数据类型 2.1 概述 2.1.1 标识符 2.1.2 关键字 2.1.3 常量 2.2 基本数据类型 第 3 章 运算符和表达式 3.2 算术运 ...

  5. pycharm新建项目时选择virtualenv的说明

    虚拟环境及venv和virtualenv介绍:https://www.cnblogs.com/mind18/p/13877170.html pip介绍:https://www.cnblogs.com/ ...

  6. JavaMail 发送邮件出现 Connection reset 问题

    问题描述 使用 java mail 发送邮件的时候,申请的 163 邮箱作为发件箱,然无论如何配置,均出现 Connection reset,无法正常发送邮件. Exception in thread ...

  7. .net 实现签名验签

    本人被要求实现.net的签名验签,还是个.net菜鸡,来分享下采坑过程 依然,签名验签使用的证书格式依然是pem,有关使用openssl将.p12和der转pem的命令请转到php实现签名验签 .ne ...

  8. 「SHOI2014」三叉神经树

    「SHOI2014」三叉神经树 给你一颗由\(n\)个非叶子结点和\(2n+1\)个叶子结点构成的完全三叉树,每个叶子结点有一个输出:\(0\)或\(1\),每个非叶子结点的输出为自己的叶子结点中较多 ...

  9. How to resolve DynamicHeight problem in Morphx report[X++]

    For set dynamic height for controls in report on executeSection method: method 01 real maxHeight; st ...

  10. ArrayList使用及原理

    之前面试时,经常被问到ArrayList的原理,今天整理了一些ArrayList的使用原理和必问的知识点. ArrayList的继承关系 定义一个ArrayList的方法 ArrayList的三个构造 ...