当前位置 : 主页 > 编程语言 > java >

Java:Maven下载安装和阿里云中央仓库配置

来源:互联网 收集:自由互联 发布时间:2023-03-22
(目录) 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.gz

2、配置环境变量

$ 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.sh

3、查看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
上一篇:从0到1入门Docker(六)Docker引擎的安装
下一篇:没有了
网友评论