最近学习Springmvc框架遇到的疑问:
创建好一个maven工程后,当你导入其他坐标(也就是jar包),下载极慢,并且会提醒下载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
因此,当maven项目需要下载一些metadata、pom、jar的时候,会优先去中央仓库下载,导致内网用户各种报错!
解决方案
在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>
参考地址:
https://stackoverflow.com/questions/12789488/how-do-you-stop-maven-from-trying-to-access-http-repo-maven-apache-org