maven国内速度过慢解决

在 Maven 配置文件中添加如下配置:

我把maven放到了/usr/local 下

修改/usr/local/maven/conf/settings.xml配置文件

中加入:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus osc</name>
<url>
http://maven.aliyun.com/nexus/content/groups/public/
</url>
</mirror>
<mirror>
<id>nexus-osc-thirdparty</id>
<mirrorOf>thirdparty</mirrorOf>
<name>Nexus aliyun thirdparty</name>
<url>
http://maven.aliyun.com/nexus/content/repositories/thirdparty/
</url>
</mirror>

其中*这个标签值一定要为“所有” ,这样所有repository请求都会先去请求镜像,否则有些请求mirror没拦截到就去请求apache了,请求apache可就慢了。

然后建工程

然后按照书上的例子代码建一个工程,

其中的pom.xml里面标签要改为http://maven.aliyun.com/nexus/content/groups/public/

然后打包,提交到spark运行吧。

速度会非常快比起之前

下面是我打包的截图:

速度很快。


Author:张琼

打赏:

当前网速较慢或者你使用的浏览器不支持博客特定功能,请尝试刷新或换用Chrome、Firefox等现代浏览器