idea如何给maven添加remote repositories远程仓库
在intellij idea 中配置好maven后 是这样的
如果加载失败,则需要自定义远程仓库,这里以阿里maven仓库为例,
在项目的pom文件中添加以下配置
<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:我当时开始失败了几次,建议多试几次😝
======================================================
2、在pom.xml中配置阿里云的中央仓库:
<repositories>
<repository>
<id>aliyun-maven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/libs-release-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/libs-milestone-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>Public Repositories</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
不积跬步无以至千里,不积小流无以成江海