• 系统: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. Mybatis---05Mybatis配置文件浅析(三)

    1.objectFactory:(对象工厂)MyBatis 每次创建结果对象的新实例时,它都会使用一个对象工厂(ObjectFactory)实例来完成. 默认的对象工厂需要做的仅仅是实例化目标类,要么 ...

  2. 如何修改hosts并保存

    Hosts文件用于本地调试,或手动设置一个域名应该被解析到哪个IP地址,在修改时会发现需要管理员权限才能修改保存,这个时候我们可以这样做 找到Hosts文件,将Hosts文件复制到桌面.(Window ...

  3. linux修改进程名

    一.linux中的进程名    linux中有很多查看/操作进程的命令.    这些命令的参数或显示的结果,有的是真实的进程名(top/pstree/pgrep/kill/killall),有的是进程 ...

  4. 程序员小抄——GitHub 热点速览 Vol.44

    作者:HelloGitHub-小鱼干 这周热点是什么?youtube-dl!就是那个超过 72+ star,又因为版权问题被 GitHub 关闭的项目,GitHub Trending 上一篇" ...

  5. Kubernetes 1.13 的完整部署手册

    前言: 非常详细的K8s的完整部署手册,由于Kubernetes版本和操作系统的版本关系非常敏感,部署前请查阅版本关系对应表 地址:https://github.com/kubernetes/kube ...

  6. [CF160D]Edges in MST (最小生成树+LCA+差分)

    待填坑 Code //CF160D Edges in MST //Apr,4th,2018 //树上差分+LCA+MST #include<cstdio> #include<iost ...

  7. 【jmeter】实现接口关联的两种方式:正则表达式提取器和json提取器

    关联通俗来讲就是把上一次请求的返回内容中的部分截取出来保存为参数,用来传递给下一个请求使用. 示例: 1.用户密码进行登录,登录后生成authentication 2.需要将登录接口响应结果中auth ...

  8. Dapr Java Http 调用

    版本介绍 Java 版本:8 Dapr Java SKD 版本:0.9.2 Dapr Java-SDK HTTP 调用文档 有个先决条件,内容如下: Dapr and Dapr CLI. Java J ...

  9. Spring5.0源码学习系列之浅谈BeanFactory创建

    Spring5.0源码学习系列之浅谈BeanFactory创建过程 系列文章目录 提示:Spring源码学习专栏链接 @ 目录 系列文章目录 博客前言介绍 一.获取BeanFactory主流程 二.r ...

  10. 第05组 Alpha冲刺 (3/6)(组长)

    .th1 { font-family: 黑体; font-size: 25px; color: rgba(0, 0, 255, 1) } #ka { margin-top: 50px } .aaa11 ...