两种方法:
1.在单个项目的pom.xml中使用 私服的连接地址,这样只对该项目起作用。
2.在maven的setting.xml配置中添加私服的连接地址。这样对所有项目起作用。
本文章只演示第二种方法:
1.确保nexus私服安装完成并启动。
2.修改本机maven/conf/setting.xml下的配置文件。
完整如下:
- 
<?xml version="1.0" encoding="UTF-8"?> 
 
- 
  
- 
<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 http://maven.apache.org/xsd/settings-1.0.0.xsd"> 
 
- 
- 
<localRepository>D:\MAVEN_repository</localRepository>  
 
- 
  
- 
<pluginGroups> </pluginGroups> 
 
- 
  
- 
- 
- 
- 
- 
- 
<username>admin</username> 
 
- 
<password>admin123</password> 
 
- 
- 
- 
- 
<username>admin</username> 
 
- 
<password>admin123</password> 
 
- 
- 
- 
- 
<username>admin</username> 
 
- 
<password>admin123</password> 
 
- 
- 
- 
- 
- 
- 
- 
<name>Nexus Repository</name> 
 
- 
<url>http://10.0.27.61:8081/content/groups/public</url> 
 
- 
- 
- 
- 
//配置仓库车插件,一旦配置了镜像,则 这个配置可忽略 
 
- 
- 
- 
- 
- 
- 
- 
<url>http://10.0.27.61:8081/content/groups/public</url> 
 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
<url>http://10.0.27.61:8081/content/groups/public</url> 
 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
<activeProfile>nexus</activeProfile> 
 
- 
- 
  
- 
maven 配置私服 连接
原文:https://www.cnblogs.com/zhuyeshen/p/11428896.html