win: C:\Users\用户名\.m2
linux: /home/用户名/.m2
正常情况下在此文件夹下会有
- repository:存放下载的依赖
- settings.xml:maven的配置
此处的settings.xml就是需要设置的文件,若没有可自行新建
下面贴出我的设置
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> <!-- 设置储存库位置 --> <localRepository>D:/.m2/repository</localRepository> <!-- 设置下载源 --> <mirrors> <!-- 阿里云 --> <mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> <!-- 默认仓库 --> <mirror> <id>repo1</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo1.maven.org/maven2/</url> </mirror> <mirror> <id>repo2</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo2.maven.org/maven2/</url> </mirror> </mirrors> </settings>