mac安装maven

解压

linxiang@192 ~ % cd /Users/linxiang/Work 
linxiang@192 Work % ls -all
total 18456
drwxr-xr-x   4 linxiang  staff      128  2 15 16:24 .
drwxr-x---+ 25 linxiang  staff      800  2 15 16:26 ..
-rw-r--r--@  1 linxiang  staff     6148  2 15 16:24 .DS_Store
-rw-r--r--@  1 linxiang  staff  9042049  2 15 16:17 apache-maven-3.8.3-bin.tar.gz
linxiang@192 Work % tar -zxvf apache-maven-3.8.3-bin.tar.gz

修改本地仓库

修改settings.xml

<localRepository>/Users/linxiang/Work/MyRepository</localRepository>

修改镜像

参考阅读文档的maven的阿里云镜像仓库配置修改settings.xml
https://blog.csdn.net/linxIT/article/details/136114067?spm=1001.2014.3001.5502

<mirror>
  <id>aliyunmaven</id>
  <mirrorOf>*</mirrorOf>
  <name>阿里云公共仓库</name>
  <url>	https://maven.aliyun.com/repository/central</url>
</mirror>

修改环境配置

linxiang@192 MyRepository % cd ~
linxiang@192 ~ % touch .bash_profile
linxiang@192 ~ % vim .bash_profile

export MAVEN_HOME=/Users/linxiang/Work/apache-maven-3.8.3
export PATH=${PATH}:${MAVEN_HOME}/bin

source .bash_profile 

# 如果遇见报错
linxiang@192 ~ % PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH

查看环境

linxiang@192 ~ % mvn -v              
Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739)
Maven home: /Users/linxiang/Work/apache-maven-3.8.3
Java version: 17.0.1, vendor: Oracle Corporation, runtime: /Users/linxiang/Work/jdk-17.0.1.jdk/Contents/Home
Default locale: zh_CN_#Hans, platform encoding: UTF-8
OS name: "mac os x", version: "14.2.1", arch: "aarch64", family: "mac"

你可能感兴趣的:(环境配置,macos,maven,经验分享)