1、setting.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups/>
<proxies/>
<servers/>
<!-- maven自动下载的jar包,会存放到该目录下 -->
<localRepository>D:\JavaFile\apache-maven-3.6.3\projectJarLib</localRepository>
<!--<mirrors>
<!–<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>–>
<mirror>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
<id>ibiblio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>google-maven-central</id>
<name>Google Maven Central</name>
<url>https://maven-central.storage.googleapis.com</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!– 中央仓库在中国的镜像 –>
<mirror>
<id>maven.net.cn</id>
<name>oneof the central mirrors in china</name>
<url>http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!– cloudera –>
<mirror>
<id>cloudera-repos</id>
<name>Cloudera Repos</name>
<url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!– aliyun –>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>-->
<profiles>
<profile>
<!-- id必须唯一 -->
<id>alimaven</id>
<repositories>
<repository>
<!-- id必须唯一 -->
<id>alimaven_1</id>
<!-- 仓库的url地址 -->
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<!-- id必须唯一 -->
<id>myRepository2</id>
<repositories>
<repository>
<!-- id必须唯一 -->
<id>myRepository2_1</id>
<!-- 仓库的url地址 -->
<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<!-- id必须唯一 -->
<id>google-maven</id>
<repositories>
<repository>
<!-- id必须唯一 -->
<id>google-maven_1</id>
<!-- 仓库的url地址 -->
<url>https://maven-central.storage.googleapis.com</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<!-- id必须唯一 -->
<id>cloudera-repos</id>
<repositories>
<repository>
<!-- id必须唯一 -->
<id>cloudera-repos_1</id>
<!-- 仓库的url地址 -->
<url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<!-- id必须唯一 -->
<id>maven.net.cn</id>
<repositories>
<repository>
<!-- id必须唯一 -->
<id>maven.net.cn_1</id>
<!-- 仓库的url地址 -->
<url>http://maven.net.cn/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<!-- id必须唯一 -->
<id>jboss-public-repository-group</id>
<repositories>
<repository>
<!-- id必须唯一 -->
<id>jboss-public-repository-group_1</id>
<!-- 仓库的url地址 -->
<url>http://repository.jboss.org/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<!-- id必须唯一 -->
<id>ibiblio</id>
<repositories>
<repository>
<!-- id必须唯一 -->
<id>ibiblio_1</id>
<!-- 仓库的url地址 -->
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<!-- id必须唯一 -->
<id>central</id>
<repositories>
<repository>
<id>central_1</id>
<!-- id必须唯一 -->
<!-- 仓库的url地址 -->
<url>http://repo1.maven.org/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<!-- 添加使用 -->
<activeProfiles>
<activeProfile>google-maven</activeProfile>
<activeProfile>myRepository2</activeProfile>
<activeProfile>cloudera-repos</activeProfile>
<activeProfile>alimaven</activeProfile>
<activeProfile>maven.net.cn</activeProfile>
<activeProfile>jboss-public-repository-group</activeProfile>
<activeProfile>ibiblio</activeProfile>
<activeProfile>central</activeProfile>
</activeProfiles>
</settings>
2、pom.xml
除了在设置里面修改,也可以在pom里面设置多个仓库
<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-tools Maven3 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
<pluginRepository>
<id>cloudera-repos</id>
<name>Cloudera Repos</name>
<url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
</pluginRepository>
<pluginRepository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
3、效果
完成后可在IDEA maven栏中看到多个配置的仓库地址