One minute
Centos7安装Java Maven开发环境
安装 Java
yum install java-11-openjdk java-11-openjdk-devel
配置环境变量
vi /etc/profile
最后加入
#set java environment
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.8.10-0.el7_8.x86_64
export JRE_HOME=$JAVA_HOME/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
使配置的环境变量生效
source /etc/profile
运行测试
java -version
javac
安装 Maven
wget https://mirrors.aliyun.com/macports/distfiles/maven3/apache-maven-3.6.3-bin.tar.gz
tar -zxvf apache-maven-3.6.3-bin.tar.gz
mv apache-maven-3.6.3 maven
mv maven /usr/local/
编辑环境
vi /etc/profile
在文件末尾添加
#maven
export MAVEN_HOME=/usr/local/maven
export PATH=${JAVA_HOME}/bin:/usr/local/mysql/bin:${MAVEN_HOME}/bin:$PATH
source /etc/profile
验证安装是否成功
mvn -v
输出
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/maven
Java version: 11.0.8, vendor: N/A, runtime: /usr/lib/jvm/java-11-openjdk-11.0.8.10-0.el7_8.x86_64
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-514.el7.x86_64", arch: "amd64", family: "unix"
安装完成
备注
# 清除项目包缓存重新安装
mvn clean install -e -U
# 启动项目
mvn spring-boot:run