搜索
热搜: 活动 交友 discuz
查看: 2391|回复: 0

[JAVA] maven地址配置为阿里maven仓库

[复制链接]

57

主题

58

帖子

1232

积分

超级版主

Rank: 8Rank: 8

积分
1232
发表于 2024-5-30 00:01:41 | 显示全部楼层 |阅读模式
官方指南
链接地址:https://help.aliyun.com/document_detail/102512.html?spm=a2c40.aliyun_maven_repo.0.0.36183054BpUElw
或者:https://maven.aliyun.com/mvn/guide
官方指南配置:
  1. <mirror>
  2.     <id>aliyunmaven</id>
  3.     <mirrorOf>*</mirrorOf>
  4.     <name>阿里云公共仓库</name>
  5.     <url>https://maven.aliyun.com/repository/public</url>
  6. </mirror>
复制代码

二、参考配置 1.设置本地仓库路径

  1. <!-- localRepository
  2.    | The path to the local repository maven will use to store artifacts.
  3.    |
  4.    | Default: ${user.home}/.m2/repository
  5.   <localRepository>/path/to/local/repo</localRepository>
  6.   -->
  7.   <localRepository>D:\dvpt_env\mvn-repo</localRepository>
复制代码

2.mirros节点中加入mirro子节点public仓库为central仓和jcenter仓的聚合仓
  1. <mirror>
  2.     <id>aliyunmaven</id>
  3.     <mirrorOf>*</mirrorOf>
  4.     <name>阿里云公共仓库</name>
  5.     <url>https://maven.aliyun.com/repository/public</url>
  6. </mirror>


  7. @deprecate

  8. <mirror>
  9.             <id>nexus-aliyun</id>
  10.             <mirrorOf>central</mirrorOf>
  11.             <name>Nexus aliyun</name>
  12.             <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
  13.     </mirror>
复制代码
3.profiles节点中加入profile子节点非必要配置。
  1. <profile>
  2.     <id>jdk-1.8</id>
  3.     <activation>
  4.         <jdk>1.8</jdk>
  5.     </activation>
  6.     <repositories>
  7.         <!-- public是central仓和jcenter仓的聚合仓。已配置在mirror节点 -->
  8.         <!--
  9.         <repository>
  10.             <id>public</id>
  11.             <url>https://maven.aliyun.com/repository/public</url>
  12.             <releases>
  13.                 <enabled>true</enabled>
  14.             </releases>
  15.             <snapshots>
  16.                 <enabled>false</enabled>
  17.             </snapshots>
  18.         </repository>
  19.          -->
  20.         <!-- 添加spring代理仓 -->
  21.         <repository>
  22.             <id>spring</id>
  23.             <url>https://maven.aliyun.com/repository/spring</url>
  24.             <releases>
  25.                 <enabled>true</enabled>
  26.             </releases>
  27.             <snapshots>
  28.                 <enabled>true</enabled>
  29.             </snapshots>
  30.         </repository>
  31.     </repositories>
  32. </profile>
复制代码






上一篇:Java实现跨域的5种方式
下一篇:windows版本nacos安装和使用
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

抖音账号
关注抖音
加入粉丝群,抽取论坛金币


Archiver|手机版|小黑屋|IT趣-GEEK社区

GMT+8, 2024-9-8 09:02 , Processed in 0.070383 second(s), 22 queries .

Powered by Discuz! X3.4. 技术支持 by 巅峰设计

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表