vim ~/.bash_profile
i
export M2_HOME=/Users/alexleon/Development/Environment/apache-maven-3.8.4
export PATH=$PATH:$M2_HOME/bin
esc
:wq
source ~/.bash_profile
mvn -v
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /Users/alexleon/Development/Environment/apache-maven-3.8.4
Java version: 1.8.0_312, vendor: Temurin, runtime: /Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"
- 配置国内镜像仓库(阿里云)
编辑M2_HOME/conf/setting.xml 文件找到节点,往里面添加配置代码
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
- 配置本地仓库
默认的缓存库 ${user.home}/.m2/repository 如需修改,修改<localRepository> 节点:
<localRepository>/Users/alexleon/Development/Environment/apache-maven-3.8.4/maven-repo</localRepository>
mvn help:system
|