maven私有库神坑之:“Downloading: http://repo.maven.apache.org/maven2/”
现象:
即使你配置了私有库,并且在maven setting.xml中配置了mirror,但是,经常会遇到执行mvn命令的时候,会提醒:
Downloading: http://repo.maven.apache.org/maven2/
原因:
所有自定义pom.xml都是继承自super pom:
http://maven.apache.org/ref/3.0.4/maven-model-builder/super-pom.html
super pom中有如下内容:
<repositories> <repository> <id>central</id> <name>Central Repository</name> <url>http://repo.maven.apache.org/maven2</url> <layout>default</layout> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> luginRepositories> luginRepository> <id>central</id> <name>Central Repository</name> <url>http://repo.maven.apache.org/maven2</url> <layout>default</layout> <snapshots> <enabled>false</enabled> </snapshots> <releases> <updatePolicy>never</updatePolicy> </releases> luginRepository> luginRepositories>
因此,当maven项目需要下载一些metadata、pom、jar的时候,会优先去中央仓库下载,导致内网用户各种报错!
解决办法:
在项目pom.xml中添加如下配置:
<repositories> <repository> <id>central</id> <url>http://host:port/content/groups/public</url> </repository> </repositories> luginRepositories> luginRepository> <id>central</id> <url>http://host:port/content/groups/public</url> luginRepository> luginRepositories>
原文出处:csdn -> https://blog.csdn.net/daijiguo/article/details/82887362
本站所发布的一切资源仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如果侵犯你的利益,请发送邮箱到 [email protected],我们会很快的为您处理。