nexus maven 本地仓库配置

本文介绍如何在无网络环境下使用Nexus作为Maven的本地仓库。通过修改pom.xml和setting.xml,确保所有Maven相关插件和jar包由Nexus管理并预先下载,以便离线时仍能正常使用。

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

网上的帖子大部分都是可以的,在这我就不用描述了,但是在没有网络的情况下先把仓库给下载完全的帖子网上是没有的。
1.修改pom.xml  这个我就不用说了这个也是可以的,但是 和maven 有关的插件不是通过 nexus 仓库管理的。
2.修改 setting.xml 这是个好办法,这样你仓库的插件还是 jar包都是通过 nexus 来管理的,只要你下载一便,在没有网路的情况下也是可以使用的
在 setting.xml 的profiles  节点下添加一下内容,url 修改为你nexus 仓库的地址

 <profile>
       <id>nexus</id>
       <repositories>
          <repository>
              <id>central</id>
              <layout>default</layout>
              <url>http://localhost:8888/nexus/content/repositories/central/</url>
              <releases><enabled>true</enabled> </releases>
              <snapshots><enabled>false</enabled></snapshots>
          </repository>
       </repositories>
       <pluginRepositories>
          <pluginRepository>
            <id>central</id>
            <url>http://localhost:8888/nexus/content/repositories/central/</url>
            <releases><enabled>true</enabled> </releases>
            <snapshots><enabled>false</enabled></snapshots>
          </pluginRepository>
       </pluginRepositories>
    </profile>


注意以上   <id>nexus</id>   这句话很重要,下面还要用到,名称你可以随便起

找到setting.xml 的末尾添加,默认是有这个标签的只是注释了,这里面的id 就是你 profile  标签的id

 <activeProfiles>
    <activeProfile>nexus</activeProfile>
  </activeProfiles>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值