栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Maven - 客户端 Nexus 配置

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Maven - 客户端 Nexus 配置

Nexus 服务端

在 部署 Nexus 私服 这篇文章中配置了 Nexus 的服务端,接下来要配置一下本地 maven 如何连接 Nexus 服务端使用。


Maven 私服配置

1、首先打开我们本地 maven 的配置文件


2、一般情况下我们会修改本地仓库位置


3、配置镜像仓库

  • 修改 元素
    • id:需要与 中的 id 匹配
    • mirrorOf:可以填入 central(只有通过中央仓库下载的依赖才会从私服下载) 或 * (所有依赖均通过私服下载)
    • name:随便
    • url:仓库地址

	
	  nexus-public
	  *
	  Nexus Public
	  http://192.168.228.18:8081/repository/maven-public/
	
  

如果 Nexus 服务端没有 开启匿名访问 的话,需要在 元素配置对应的访问认证信息,id 要与上面 mirror 中的 id 对应


	
	  nexus-public
	  admin
	  123456
	

4、通过 mvn deploy 命令推送 jar 包到私服

  • 配置 访问认证信息

	
	  nexus-releases
	  admin
	  123456
	

	
	  nexus-snapshots
	  admin
	  123456
	
  
  • 配置项目中的 pom.xml 文件,这里的 id 要与上面 server 中的 id 对应

    
        nexus-releases
        Nexus Release Repository
        http://192.168.228.18:8081/repository/maven-releases/
    
    
        nexus-snapshots
        Nexus Snapshot Repository
        http://192.168.228.18:8081/repository/maven-snapshots/
    

完整的 pom.xml



  D:repo

  
	
	  nexus-public
	  admin
	  123456
	
	
	
	  nexus-releases
	  admin
	  123456
	

	
	  nexus-snapshots
	  admin
	  123456
	
  

  
	
	  nexus-public
	  *
	  Nexus Public
	  http://192.168.228.18:8081/repository/maven-public/
	
  

npm 私服配置

在 部署 Nexus 服务端 ,配置仓库的时候,我们知道 Nexus 不仅可以作为 maven 的私服,还可以作为 docker、apt、npm 等依赖管理工具的私服,这里我们配置一下 npm 私服仓库

1、配置代理仓库,代理淘宝镜像源

  • npm(proxy)
    • Name:npm-taobao
    • Remote storage:https://registry.npm.taobao.org

2、配置私有仓库

  • npm(hosted)
    • Name:npm-hosted

3、配置分组仓库

  • npm(group)
    • Name:npm-public
    • Group:包含 npm-taobao 和 npm-hosted
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/996617.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号