Maven配置远程仓库

方法一:修改maven配置文件

我使用的是IDEA编译器,使用maven自己的库下载文件非常的慢。阿里代理了很多公共的maven仓库,使用maven.aliyun.com中的仓库地址作为下载源,速度更快更稳定。

打开你的maven的安装地址,找到conf文件夹下面的settings.xml文件并打开,在标签中间插入镜像的配置参数。


    aliyunmaven
    central
    central库
    https://maven.aliyun.com/repository/central

如果需要替换的话,将URL中的地址替换为下表中的Path列所对应的url。

Repository

Type

Policy

Path

apache snapshots

proxy

SNAPSHOT

https://maven.aliyun.com/repository/apache-snapshots

central

proxy

RELEASE

https://maven.aliyun.com/repository/central

google

proxy

RELEASE

https://maven.aliyun.com/repository/google

gradle-plugin

proxy

RELEASE

https://maven.aliyun.com/repository/gradle-plugin

jcenter

proxy

RELEASE

https://maven.aliyun.com/repository/jcenter

spring

proxy

RELEASE

https://maven.aliyun.com/repository/spring

spring-plugin

proxy

RELEASE

https://maven.aliyun.com/repository/spring-plugin

public

group

RELEASE

https://maven.aliyun.com/repository/public

releases

hosted

RELEASE

https://maven.aliyun.com/repository/releases

snapshots

hosted

SNAPSHOT

https://maven.aliyun.com/repository/snapshots

grails-core

proxy

RELEASE

https://maven.aliyun.com/repository/grails-core

mapr-public

proxy

RELEASE

https://maven.aliyun.com/repository/mapr-public

保存并重启编译器即可。

方法二:修改项目的pom.xml文件

打开你的项目,找到pom.xml文件,在中添加仓库,格式如下。仓库的地址同第一种方法中的仓库地址。


        
            maven-ali
            https://maven.aliyun.com/repository/public
            
                true
            
            
                true
                always
                fail
            
        

 

 

你可能感兴趣的:(Java)