- 打开maven的settings.xml文件
- 首先可配置maven的本地仓库路径
-
<localRepository>D:\java\apache-maven-3.6.3\resourceRoot</localRepository>
-
- 配置自己搭建的maven的服务名以及账号密码
-
<server><id>xxxxServer</id><username>xxxx</username><password>xxxxx</password></server>
-
- 配置镜像地址信息列表
-
<mirror><id>xxxxServer</id><mirrorOf>xxxxServer</mirrorOf><url>http://xxxxxxxxxx/xxxx/repository/internal</url></mirror><mirror><id>alimaven</id><url>https://maven.aliyun.com/repository/public</url><mirrorOf>central</mirrorOf></mirror><mirror><id>nexus-aliyun</id><mirrorOf>central</mirrorOf><url>http://maven.aliyun.com/nexus/content/groups/public</url></mirror>
-
- 配置仓库下载优先级
-
<profile><id>nexus</id><repositories><repository><id>xxxxServer</id><url>http://xxxxxx/xxxxxx/repository/internal</url><snapshots><enabled>false</enabled></snapshots><releases><enabled>true</enabled></releases></repository><repository><id>nexus-aliyun</id><url>http://maven.aliyun.com/nexus/content/groups/public</url><snapshots><enabled>false</enabled></snapshots><releases><enabled>true</enabled></releases></repository><repository><id>alimaven</id><url>https://maven.aliyun.com/repository/public</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository></repositories><pluginRepositories><pluginRepository><id>xxxxServer</id><url>http://xxxxxxxx/xxxxxxx/repository/internal</url><snapshots><enabled>false</enabled></snapshots><releases><enabled>true</enabled></releases></pluginRepository><pluginRepository><id>nexus-aliyun</id><url>http://maven.aliyun.com/nexus/content/groups/public</url><snapshots><enabled>false</enabled></snapshots><releases><enabled>true</enabled></releases></pluginRepository><pluginRepository><id>alimaven</id><url>https://maven.aliyun.com/repository/public</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository></pluginRepositories></profile>
-
- 设置活跃配置
-
<activeProfiles><activeProfile>nexus</activeProfile></activeProfiles>
-
- 然后在项目中配置好当前的maven的settings.xml就可以愉快的使用maven仓库了