问题:
maven打包时出现:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?的报错
解决方案:卸载centos自带的java,安装jdk1.8
具体步骤:
1)查看系统是否已安装的java:rpm -qa|grep java
2)卸载已安装的jdk,注意一定要有java-XXX-jdk-XXX才能下载,输入指令如下
rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.332.b09-1.el7_9.x86_64
rpm -e --nodeps java-1.8.0-openjdk-1.8.0.332.b09-1.el7_9.x86_64
3)卸载后查看jdk输入指令:java -version
4)重新安装JDK,将对应的压缩包解压:tar -xzvf jdk-8u141-linux-x64.tar.gz
5)配置环境变量,在~/.bash_profile文件中添加如下两行
export JAVA_HOME=/usr/java/jdk1.8.0_141
export PATH=$PATH:$JAVA_HOME/bin
6)输入指令:source ~/.bash_profile使环境变量生效
7)再次使用Maven打包,可看到打包成功