700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > maven加载依赖时总是Updating [central] https://repo.maven.apache.org/maven2

maven加载依赖时总是Updating [central] https://repo.maven.apache.org/maven2

时间:2023-02-15 22:09:55

相关推荐

maven加载依赖时总是Updating [central] https://repo.maven.apache.org/maven2

最近在使用maven添加依赖的时候,动不动idea就会从Updating [central] https://repo./maven2开始下载1.23G的文件。即使在maven setting.xml中配置了阿里云的镜像。

原因是所有自定义pom.xml都是继承自super pom:

<repositories><repository><id>central</id><name>Central Repository</name><url>http://repo./maven2</url><layout>default</layout><snapshots><enabled>false</enabled></snapshots></repository></repositories><pluginRepositories><pluginRepository><id>central</id><name>Central Repository</name><url>http://repo./maven2</url><layout>default</layout><snapshots><enabled>false</enabled></snapshots><releases><updatePolicy>never</updatePolicy></releases></pluginRepository></pluginRepositories>

因此当maven加载依赖的时候,总是会优先去中央仓库下载,

解决办法,在项目pom.xml中添加如下配置:

<repositories><repository><id>central</id><url>http://host:port/content/groups/public</url></repository></repositories><pluginRepositories><pluginRepository><id>central</id><url>http://host:port/content/groups/public</url></pluginRepository></pluginRepositories>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。