配置多个maven 仓库
构建项目时报错: Cannot resolve com.gexin.platform:gexin-rp-sdk-http:4.1.1.4
gexin-rp-sdk-http:jar:4.1.1.4总是无法下载,百度到的处理方法,记录一下,方便以后查询使用。
解决方式:
修改本地maven/config/目录下的settings.xml文件,在原先配置aliyun镜像处,修改mirroOf参数值 加上 ,!getui-nexus
标识getui-nexus这个依赖不从aliyun进行下载
注意逗号,因为多个要用逗号隔开。
<mirror> <id>nexus-aliyun</id> <mirrorOf>*,!getui-nexus</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> </mirror>
关于上述配置参数的说明:
‘’= everything
external:* = everything not on the localhost and not file based.
repo,repo1 = repo or repo1
*,!repo1 = everything except repo1
配置完成后,还需要在IntelliJ IDEA或Eclipse中更新配置文件,以生效。
菜单栏Window——Preferencecs——Maven——User Setting–update Settings applyandclose
然后 maven updateproject。
结束语:
如果出现其他ali镜像无法下载,可以将getui-nexus 相应的替换 仓库ID
!!!PS:配置本地私有仓库,需要配置<profile>才会生效
1 <?xml version="1.0" encoding="UTF-8"?> 2 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> 5 6 <mirrors> 7 <mirror> 8 <id>nexus-aliyun</id> 9 <mirrorOf>central</mirrorOf> 10 <name>Nexus aliyun</name> 11 <url>http://maven.aliyun.com/nexus/content/groups/public</url> 12 </mirror> 13 <mirror> 14 <id>nexus-local</id> 15 <mirrorOf>*</mirrorOf> 16 <name>Nexus local</name> 17 <url>http://10.10.64.118:8081/nexus/content/groups/public/</url> 18 </mirror> 19 <mirror> 20 <id>Centit</id> 21 <name>Centit</name> 22 <mirrorOf>Centit</mirrorOf> 23 <url>http://develop.centit.com/nexus/content/repositories/centit-releases/</url> 24 </mirror> 25 <mirror> 26 <id>getui-nexus</id> 27 <mirrorOf>*</mirrorOf> 28 <name>个推推送</name> 29 <url>http://mvn.gt.getui.com/nexus/content/repositories/releases/</url> 30 </mirror> 31 </mirrors> 32 <profiles> 33 <profile> 34 <id>purangnesxus</id> 35 <repositories> 36 <repository> 37 <id>local-nexus</id> 38 <url>http://10.10.64.118:8081/nexus/content/groups/public/</url> 39 <releases> 40 <enabled>true</enabled> 41 </releases> 42 <snapshots> 43 <enabled>true</enabled> 44 </snapshots> 45 </repository> 46 </repositories> 47 </profile> 48 </profiles> 49 <activeProfiles> 50 <activeProfile>purangnesxus</activeProfile> 51 </activeProfiles> 52 </settings>
另一个参考
1 <?xml version="1.0" encoding="UTF-8"?> 2 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> 5 6 <mirrors> 7 <mirror> 8 <id>nexus-aliyun</id> 9 <mirrorOf>central</mirrorOf> 10 <name>Nexus aliyun</name> 11 <url>http://maven.aliyun.com/nexus/content/groups/public</url> 12 </mirror> 13 <mirror> 14 <id>local-nexus</id> 15 <mirrorOf>local-nexus</mirrorOf> 16 <name>Nexus local</name> 17 <url>http://10.10.64.118:8081/nexus/content/groups/public/</url> 18 </mirror> 19 <mirror> 20 <id>getui-nexus</id> 21 <mirrorOf>getui-nexus</mirrorOf> 22 <name>个推推送</name> 23 <url>http://mvn.gt.getui.com/nexus/content/repositories/releases/</url> 24 </mirror> 25 <mirror> 26 <id>Centit</id> 27 <name>Centit</name> 28 <mirrorOf>Centit</mirrorOf> 29 <url>http://develop.centit.com/nexus/content/repositories/centit-releases/</url> 30 </mirror> 31 32 </mirrors> 33 <profiles> 34 <profile> 35 <id>purangnesxus</id> 36 <repositories> 37 <repository> 38 <id>local-nexus</id> 39 <url>http://10.10.64.118:8081/nexus/content/groups/public/</url> 40 <releases> 41 <enabled>true</enabled> 42 </releases> 43 <snapshots> 44 <enabled>true</enabled> 45 </snapshots> 46 </repository> 47 <repository> 48 <id>getui-nexus</id> 49 <url>http://mvn.gt.getui.com/nexus/content/repositories/releases/</url> 50 <releases><enabled>true</enabled></releases> 51 <snapshots><enabled>true</enabled></snapshots> 52 </repository> 53 54 55 56 </repositories> 57 </profile> 58 </profiles> 59 <activeProfiles> 60 <activeProfile>purangnesxus</activeProfile> 61 </activeProfiles> 62 </settings>
posted on 2022-08-04 10:14 SH-xuliang 阅读(1149) 评论(0) 编辑 收藏 举报