ctrlC & ctrlV

我们不生产代码,我们只是代码的搬运工~

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  75 随笔 :: 0 文章 :: 22 评论 :: 30万 阅读
< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

首先需要配置远程仓库私服的服务器账号、密码,找到maven的settings.xml文件,配置<server>,里边的ID注意,就是标识你仓库的唯一ID,可以根据你的仓库随意起名就行。

复制代码
 1   <servers>
 2     <!-- server
 3      | Specifies the authentication information to use when connecting to a particular server, identified by
 4      | a unique name within the system (referred to by the 'id' attribute below).
 5      |
 6      | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
 7      |       used together.
 8      |
 9     <server>
10       <id>deploymentRepo</id>
11       <username>repouser</username>
12       <password>repopwd</password>
13     </server>
14     -->
15  
16     <!-- Another sample, using keys to authenticate.
17     <server>
18       <id>siteServer</id>
19       <privateKey>/path/to/private/key</privateKey>
20       <passphrase>optional; leave empty if not used.</passphrase>
21     </server>
22     -->
23     <!-- 在这里添加配置私仓的ID和账号、密码 -->
24     <server>
25       <id>mycentral</id>
26       <username>私服账号</username>
27       <password>私服密码</password>
28     </server>
29     <server>
30       <id>mysnapshots</id>
31       <username>私服账号</username>
32       <password>私服密码</password>
33     </server>
34   </servers>
复制代码

然后找到你代码工程中的pom.xml文件,配置<distributionManagement>或<repositories>,这2个字段的区别就是

distributionManagement是使用mavne deploy上传打好的包。

repositories就跟打包上传无关,只是你想在POM中配置其它的远程仓库。

所以你可以根据需要全部配置或只配置其中一个。注意其中的ID,一定要和你在settings.xml中配置server账号的ID保持一致,才能关联生效

复制代码
 1 <distributionManagement>
 2         <repository>
 3             <!--注意ID配置与settings.xml中server配置ID保持一致-->
 4             <id>mycentral</id>
 5             <name>Artifactory-releases</name>
 6             <url>https://私仓地址.com.cn/artifactory/Management_Application_Maven</url>
 7         </repository>
 8         <snapshotRepository>
 9             <id>mysnapshots</id>
10             <name>Artifactory-snapshots</name>
11             <url>https://私仓地址.com.cn/artifactory/Management_Application_Maven</url>
12         </snapshotRepository>
13 </distributionManagement>
复制代码
复制代码
 1     <repositories>
 2         <repository>
 3             <!--注意ID配置与settings.xml中server配置ID保持一致-->
 4             <id>mysnapshots</id>
 5             <url>https://devstack.vgc.com.cn/artifactory/Timesheet_Management_Application_Maven</url>
 6             <snapshots>
 7                 <enabled>true</enabled>
 8             </snapshots>
 9         </repository>
10         <repository>
11             <!--注意ID配置与settings.xml中server配置ID保持一致-->
12             <id>mycentral</id>
13             <url>https://devstack.vgc.com.cn/artifactory/Timesheet_Management_Application_Maven</url>
14         </repository>
15         <repository>
16             <id>alimaven</id>
17             <name>aliyun maven</name>
18             <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
19             <releases>
20                 <enabled>true</enabled>
21             </releases>
22             <snapshots>
23                 <enabled>false</enabled>
24             </snapshots>
25         </repository>
26     </repositories>
复制代码

 

posted on   Rocky_  阅读(2884)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· PPT革命!DeepSeek+Kimi=N小时工作5分钟完成?
· What?废柴, 还在本地部署DeepSeek吗?Are you kidding?
· DeepSeek企业级部署实战指南:从服务器选型到Dify私有化落地
· 程序员转型AI:行业分析
· 重磅发布!DeepSeek 微调秘籍揭秘,一键解锁升级版全家桶,AI 玩家必备神器!
历史上的今天:
2018-10-25 postman插件部分Header设置无效的解决办法
点击右上角即可分享
微信分享提示