maven打包时报No compiler is provided in this environment处理
系统: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处理的更多相关文章
- 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]-->[ ...
- 【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 ...
- 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. ...
- maven打包错误:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] Scanning for projects...[INFO] ...
- 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 ...
- 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 ...
- 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 ...
- 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? 你应该 ...
- [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 ...
随机推荐
- (CS229)监督学习应用和梯度下降
监督学习:基于标记数据的学习 监督学习又举了两个例子:回归问题regression在连续数据上的模型构建问题 和 分类问题 classification 在离散数据上的问题 无监督学习:未标记的学习 ...
- 一些常见JAVA问题
原文:https://blog.csdn.net/weiyongxuan/article/details/45920765 一.Java的异常的基类是java.lang.Throwable 二.守护线 ...
- Kitty基于Spring Boot、Spring Cloud、Vue.js、Element实现前后端分离的权限管理系统
源码地址:https://gitee.com/liuge1988/kitty 软件架构 后端架构 开发环境 IDE : eclipse 4.x JDK : JDK1.8.x Maven : Maven ...
- git的远程分支是干啥的,和本地的有什么区别?
不知道大家有没有经历过,当我们切换到了一个新的分支想要提交代码的时候,总会遇到这样的错误. 我们把日志里的英文翻译过来是说,我们当前的分支没有设置任何上游分支.然后git提示我们可以运行下面这行代码来 ...
- AtCoder Grand Contest 013D: Piling Up 题解
题意简化: [luogu] Piling Up 一开始有n个颜色为黑白的球,但不知道黑白色分别有多少,m次操作,每次先拿出一个球,再放入黑白球各一个,再拿出一个球,最后拿出的球按顺序排列会形成一个颜色 ...
- day81:luffy:课程分类页面&课程信息页面&指定分类显示课程信息&分页显示课程信息
目录 1.构建课程前端初始页面 2.course后端的准备工作 3.后端实现课程分类列表接口 4.前端发送请求-获取课程分类信息 5.后端实现课程列表信息的接口 6.前端显示列表课程信息 7.按照指定 ...
- 热部署只知道devtools吗?JRebel不香吗?
持续原创输出,点击上方蓝字关注我 目录 前言 JRebel收费怎么破? 什么是本地热部署? 什么是远程热部署? JRebel和devtools的区别 如何安装JRebel? 如何本地热部署? 如何远程 ...
- docker部署redis主从和哨兵
docker部署redis主从和哨兵 原文地址:https://www.jianshu.com/p/72ee9568c8ea 1主2从3哨兵 一.前期准备工作 1.电脑装有docker 2.假设本地i ...
- ubuntu下安装nginx -php
mysql : sudo apt-get install mysql-server mysql-client nginx: sudo apt-get install nginx安装Nginx稳定版本 ...
- JavaSE基础语法学习-流程控制
流程控制 用户交互Scanner Scanner**对象** 下面是创建 Scanner 对象的基本语法: Scanner s = new Scanner(System.in); 接下来我们演示一个最 ...