首先需要配置远程仓库私服的服务器账号、密码,找到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>
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· PPT革命!DeepSeek+Kimi=N小时工作5分钟完成?
· What?废柴, 还在本地部署DeepSeek吗?Are you kidding?
· DeepSeek企业级部署实战指南:从服务器选型到Dify私有化落地
· 程序员转型AI:行业分析
· 重磅发布!DeepSeek 微调秘籍揭秘,一键解锁升级版全家桶,AI 玩家必备神器!
2018-10-25 postman插件部分Header设置无效的解决办法