(目录) 1、Java环境 java -versionopenjdk version 1.8.0_332OpenJDK Runtime Environment (build 1.8.0_332-b09)OpenJDK 64-Bit Server VM (build 25.332-b09, mixed mode) 2、下载安装Maven Linux/Mac: apache-maven-3.9.0-bin.tar.gz Windows: a
(目录)
1、Java环境
java -version openjdk version "1.8.0_332" OpenJDK Runtime Environment (build 1.8.0_332-b09) OpenJDK 64-Bit Server VM (build 25.332-b09, mixed mode)2、下载安装Maven
- Linux/Mac: apache-maven-3.9.0-bin.tar.gz
- Windows: apache-maven-3.9.0-bin.zip
1、下载解压
# 安装到opt目录下 wget https://dlcdn.apache.org/maven/maven-3/3.9.0/binaries/apache-maven-3.9.0-bin.tar.gz tar -zxcf apache-maven-3.9.0-bin.tar.gz2、配置环境变量
$ vim /etc/profile.d/maven.sh # maven export MAVEN_HOME=/opt/apache-maven-3.9.0 export PATH=$PATH:$MAVEN_HOME/bin执行生效
$ source /etc/profile.d/maven.sh3、查看Maven
$ mvn -v Apache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584) Maven home: /opt/apache-maven-3.9.0 Java version: 1.8.0_332, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.332.b09-1.el7_9.x86_64/jre Default locale: zh_CN, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-1127.19.1.el7.x86_64", arch: "amd64", family: "unix"3、阿里云Maven中央仓库
文档:https://developer.aliyun.com/mvn/guide
vim /opt/apache-maven-3.9.0/conf/settings.xml镜像标签<mirrors></mirrors>增加子节点
<mirror> <id>aliyunmaven</id> <mirrorOf>*</mirrorOf> <name>阿里云公共仓库</name> <url>https://maven.aliyun.com/repository/public</url> </mirror>参考
- https://www.runoob.com/maven/maven-setup.html