在搭建Maven工程时,解决导入依赖过慢问题可以通过设置镜像仓库为阿里云镜像仓库来解决,springboot项目解决此问题也一样。
有两种设置方法:
方法一:
在springboot项目的pom.xml文件中添加以下代码(更改镜像为阿里云)
<repositories> <repository> <id>aliyun-repos</id> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>aliyun-plugin</id> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories>
方法二:
在Maven的 config / setting.xml 文件中添加如下代码(更改镜像为阿里云)
<mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror>