maven settings 配置文件解析-进阶

本文详细解析Maven中mirror配置的作用,如何将其设置为默认值,以及如何动态切换。介绍了如何通过阿里云Maven仓库访问所有远程仓库,解释了mirror作为中间商连接远程仓库的概念,并提到了公司私有仓库的配置方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

多个mirror镜像只有第一条起作用,可以将id改为default作为默认值(如果没有default,会用第一个mirror),可以动态切换;
默认情况下,执行 mvn help:effective-settings 查看使用哪个仓,执行 mvn help-effective-settings -D{mirrorsOf}=central 指定镜像。
 这里,mirrorOf 配置成 * 就代表我们通过访问阿里云的maven仓库从而访问网络上所有的远程仓库;
mirror就相当于通过中间商连接到远程仓库,比如通过阿里url镜像连接到maven远程仓库;
私服库通过profile配置并activeProfiles激活,比如公司的私有服;

D:\soft\jdk\bin\java.exe -Dmaven.multiModuleProjectDirectory=D:\ideaPro\surveyking-master\server\rdbms -Dmaven.home=D:\soft\maven\apache-maven-3.6.3 -Dclassworlds.conf=D:\soft\maven\apache-maven-3.6.3\bin\m2.conf "-Dmaven.ext.class.path=D:\soft\IntelliJ IDEA 2021.2.2\plugins\maven\lib\maven-event-listener.jar" "-javaagent:D:\soft\IntelliJ IDEA 2021.2.2\lib\idea_rt.jar=59001:D:\soft\IntelliJ IDEA 2021.2.2\bin" -Dfile.encoding=UTF-8 -classpath D:\soft\maven\apache-maven-3.6.3\boot\plexus-classworlds-2.6.0.jar;D:\soft\maven\apache-maven-3.6.3\boot\plexus-classworlds.license org.codehaus.classworlds.Launcher -Didea.version=2021.2.2 -s D:\soft\maven\apache-maven-3.6.3\conf\settings.xml install -P dev [INFO] Scanning for projects... [INFO] [INFO] ------------------------< cn.surveyking:rdbms >------------------------- [INFO] Building rdbms v1.8.2 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.548 s [INFO] Finished at: 2025-04-01T17:57:09+08:00 [INFO] ------------------------------------------------------------------------ [WARNING] The requested profile "dev" could not be activated because it does not exist. [ERROR] Failed to execute goal on project rdbms: Could not resolve dependencies for project cn.surveyking:rdbms:jar:v1.8.2: Failed to collect dependencies at cn.surveyking:shared:jar:v1.8.2: Failed to read artifact descriptor for cn.surveyking:shared:jar:v1.8.2: Failure to find cn.surveyking:survey-server:pom:${revision} in http://maven.aliyun.com/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus-aliyun has elapsed or updates are forced -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException Process finished with exit code 1
最新发布
04-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值