配置阿里云maven仓库

朱雀 2022-07-15 03:53 486阅读 0赞

第一步
在maven的setting.xml文件中的<profiles></profiles>标签中配置如下:

  1. <profile>
  2. <id>dev</id>
  3. <repositories>
  4. <repository>
  5. <id>nexus</id>
  6. <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
  7. <releases>
  8. <enabled>true</enabled>
  9. </releases>
  10. <snapshots>
  11. <enabled>true</enabled>
  12. </snapshots>
  13. </repository>
  14. </repositories>
  15. <pluginRepositories>
  16. <pluginRepository>
  17. <id>nexus</id>
  18. <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
  19. <releases>
  20. <enabled>true</enabled>
  21. </releases>
  22. <snapshots>
  23. <enabled>true</enabled>
  24. </snapshots>
  25. </pluginRepository>
  26. </pluginRepositories>
  27. </profile>

第二步
在maven的setting.xml文件中配置如下(使第二步的配置起作用,
至于在哪配置,在setting.xml中是有示例的,自己找找):

  1. <activeProfiles>
  2. <activeProfile>dev</activeProfile>
  3. </activeProfiles>

这样,在pom.xml中依赖的库就会从阿里云的maven库中去下载,感觉上速度会快不少。

如果使用Eclipse,需要指定你的setting.xml后点击update settings按钮才会生效,如下图所示:
这里写图片描述

发表评论

表情:
评论列表 (有 0 条评论,486人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Maven配置阿里仓库

    Maven简介: Maven项目[对象模型][Link 1](POM),可以通过一小段描述信息来管理项目的构建,报告和文档的[项目管理工具][Link 2]软件。 Ma