一、配置settings.xml文件
下载解压后在conf文件夹里打开settings.xml文件,在标记中插入如下代码(如果没有的标记需要在标记外加入标记):
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
二、如果配置完setting.xml文件后不能从阿里云下载,就在pom.xml文件配置如下代码:
复制代码
<repositories>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
复制代码
标记和pom.xml文件中的标记同级
我之前只配置了第一步,老是报错,不能从阿里云下载,删除第一步之后能从默认的maven中央库下载,后来在每个pom.xml文件里配置了第二步就好使了。不知道应为啥