nexus-3.9.0搭建maven私服

本文介绍如何使用Nexus 3搭建Maven仓库,包括下载安装、配置代理及本地仓库、设置仓库组,以及如何上传第三方库文件,并提供了一个maven配置文件setting.xml的示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.下载地址

https://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-3.9.0-01-win64.zip

 

2.注册服务启动

找到目录下nexus-3.9.0-01\bin\nexus.exe  cmd命令下执行 nexus.exe /run

类似参数(start, stop, restart, force-reload and status)

或者注册为系统服务 ,执行 nexus.exe /install <optional-service-name>

nexus.exe /start <optional-service-name>

 

nexus.exe /stop <optional-service-name>

 

nexus.exe /uninstall <optional-service-name>

 

3.建立你的maven仓库

3.1建立代理仓库

访问http://localhost:8081/

默认这个nexus创建好了一些仓库,我们统统删了


 

 

 

 

 

 

先建立一个代理maven仓库

 

 


最终类似

 我代理的是:https://repo1.maven.org/maven2/

代理仓库:是指我们下载的文件会在私服上保存一份,第一下载到远程中央库(https://repo1.maven.org/maven2/)下载,第二次从我们的私服下载

 

3.2建立本地仓库(第三方我们自己的包库)

类型选择mave2(hosted)就可以了,之后填写名字就可以了

 

 

3.3 建立仓库组

选择mave2(group)

 

 

建立仓库组的好处就是我们只需要配置仓库组的地址给客户端,而不需要配置两个地址(一个本地,一个代理),就可以了

 

4.上传我们的第三方库文件

 

按要求填写groupid等等就可以了

 

 

 

 

 

5.你的maven配置文件setting.xml

<settings>

 

  <mirrors>

 

<mirror>

 

  <!--This sends everything else to /public -->

 

  <id>nexus</id>

 

  <mirrorOf>*</mirrorOf>

 

  <url>http://192.168.100.163:8081/repository/maven-group/</url>

 

<!-- 这个地址就是我们仓库组的地址 -->

</mirror>

 

  </mirrors>

 

  <profiles>

 

<profile>

 

  <id>nexus</id>

 

  <!--Enable snapshots for the built in central repo to direct -->

 

  <!--all requests to nexus via the mirror -->

 

  <repositories>

 

    <repository>

 

      <id>central</id>

 

      <url>http://central</url>

 

      <releases><enabled>true</enabled></releases>

 

      <snapshots><enabled>true</enabled></snapshots>

 

    </repository>

 

  </repositories>

 

 <pluginRepositories>

 

    <pluginRepository>

 

      <id>central</id>

 

      <url>http://central</url>

 

      <releases><enabled>true</enabled></releases>

 

      <snapshots><enabled>true</enabled></snapshots>

 

    </pluginRepository>

 

  </pluginRepositories>

 

</profile>

 

  </profiles>

 

  <activeProfiles>

 

<!--make the profile active all the time -->

 

<activeProfile>nexus</activeProfile>

 

  </activeProfiles>

<

</settings>

 更多配置可以参考官方文档

https://help.sonatype.com/repomanager3/quick-start-guide-proxying-maven-and-npm


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值