idea如何给maven添加remote repositories远程仓库

在intellij idea 中配置好maven后 是这样的maven

 

 

 

若是加载失败,则须要自定义远程仓库,这里以阿里maven仓库为例,ide

 

 

 

在项目的pom文件中添加如下配置url

复制代码
<repositories>
        <repository>
            <id>alimaven</id>
            <name>Maven Aliyun Mirror</name>
            <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
复制代码

repositories中可配置多个仓库repository(这里只配置了一个),id:惟一标识,name:自定义仓库名称,url:远程仓库地址,
releases 的enable设置为true,告诉maven能够下载releases(稳定版本)的构件;snapshots 的enable 为false,即为禁止下载snapshot(开发中、不稳定)的构件
关于该配置的更多说明可参考 https://blog.csdn.net/zlgydx/article/details/51130627

此时















 

 

 ps:我当时开始失败了几回,建议多试几回😝
相关文章
相关标签/搜索