maven 私服搭建-nexus 浅浅的花香味﹌ 2022-05-24 04:48 237阅读 0赞 # 1.下载nexus # [nexus-2.14.5-02-bundle.tar.gz][] # 2.解压 # tar -zxvf nexus-2.14.5-02-bundle.tar.gz 解压完毕后会出现两个文件夹: * nexus-2.14.5-02 源码包 * sonatype-work 仓库 # 3.在环境变量当中设置启动用户 # vim /etc/profile **添加profile文件。安全起见不建议使用root用户,如果使用其它用户需要加相应权限 (以root为例)** export RUN_AS_USER=root # 4.配置启动参数 # vim nexus-2.14.5-02/conf/nexus.properties #端口号 application-port=8081 #仓库地址 nexus-work=${bundleBasedir}/../sonatype-work/nexus # 5.启动与停止nexus # #启动 shell> nexus-2.14.5-02/bin/nexus start #停止 shell> nexus-2.14.5-02/bin/nexus stop # 6.登录nexus 界面 # 地址:http://{ip}:8081/nexus/ 用户名:admin 密码:admin123 ![70][] ## 6.1 修改proxy类型仓库配置 ## ![70 1][] ![70 2][] # 7.repositories介绍 # 看下基础结构 ![70 3][] ## 7.1 type几种类型 ## * group 组-可以把多个仓库组成一个大的仓库 * hosted 私有化仓库-我们本地上传的jar * proxy 代理仓库-从互联网上下载下来的jar ### 7.1.1 如何添加一个分组 ### ![70 4][] 把需要组成一个组的仓库移动到左边,排好序,jar包搜索顺序事按照从下至下的顺序查找的,点击保存即可。 ### 7.1.2 hosted仓库介绍 ### hosted仓库分为三种: * 3rd party 第三方jar-例如其他公司直接提供给我们的sdk * Snapshots 本地项目jar包快照版 * Releases 本地项目jar包正式版(注意此仓库版本号带Snapshots 无法上传) # 8.本地maven从私服配置上传下载 # ## 8.1 下载 ## ### 8.1.1 配置快照地址 ### 直接配置至组的访问地址即可 <mirror> <id>ganinfo</id> <name>ganinfo</name> <mirrorOf>*</mirrorOf> <url>http://xxxx:8081/nexus/content/groups/ganinfo/</url> </mirror> ## 8.2 上传 ## 配置setting.xml <server> <id>iotreleases</id> <username>deployment</username> <password>123456</password> </server> <server> <id>iotsnapshots</id> <username>deployment</username> <password>123456</password> </server> 配置pom文件 <distributionManagement> <repository> <id>iotreleases</id> <name>iot releases</name> <url>http://xxxx:port/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>iotsnapshots</id> <name>iot snapshots</name> <url>http://xxxx:port/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement> [nexus-2.14.5-02-bundle.tar.gz]: https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.14.5-02-bundle.tar.gz [70]: /images/20220524/96bf3e984d3e4596a74b1a8b2c3e5df1.png [70 1]: /images/20220524/e0040e2d0d8947c1a77b7851d5ff141a.png [70 2]: /images/20220524/7a5f0466884c45c48136cca3606ca3ff.png [70 3]: /images/20220524/036b3fcf1c4a4a3d98c538b94be820ea.png [70 4]: /images/20220524/a2ec3e2ca5854d35b8283eb92a101922.png
还没有评论,来说两句吧...