搭建自己的maven私服

1. 下载nexus
下载地址: https://www.sonatype.com/download-oss-sonatype
2. 启动对应版本的nexus
…/nexus-2.14.8-01-bundle\nexus-2.14.8-01\bin\jsw
搭建自己的maven私服_第1张图片
3. 访问nexus
http://localhost:8081/nexus
默认用户名/密码 : admin/admin123
搭建自己的maven私服_第2张图片
type表示仓库类型:

类型 用途
hosted 表示当前开发人员上传的,包括snapshots快照版本/releases稳定版本/3rd party第三方包三种仓库;表示当前开发人员上传的,包括snapshots快照版本/releases稳定版本/3rd party第三方包三种仓库;
proxy 表示中央服仓库,包括snapshots快照版本/releases稳定版本两种仓库;

举个例子就是,
你上传jar包时,release版本就会上保存到hosted的releases仓库,snapshot版本就会保存到hosted的snapshots仓库;
你下载jar包时,就回到中央仓库找;

4. 初始化nexus
刚启动的nexus是搜不到jar包信息的,需要从中央仓库同步先
选中central仓库—>tab页中选中configuration---->download remote indexs 选择true
选择完后,nexus会创建一个任务从中央仓库同步jar包索引,耗时一两个小时;
5. 上传jar包
a)maven的settings.xml中配置nexus的认证信息


	
      nexus-releases
      admin
      admin123
    
	
      nexus-snapshots
      admin
      admin123
    

b)项目的pom.xml中配置nexus的地址信息,此处id必须和settings中的id对应

 
        
            nexus-releases
            nexus releases repository
            http://localhost:8081/nexus/content/repositories/releases/
        
        
            nexus-snapshots
            nexus  snapshotRepository
            http://localhost:8081/nexus/content/repositories/snapshots/
        
    

c) deploy jar包

6. 下载jar包
maven的settings.xml文件中配置
content/groups/public仓库表示同时可以从proxy/hosted仓库获取jar包


    
      dev
      
        
  		public
  			public repository
  			http://ip:8081/nexus/content/groups/public/
  		
    			true
  		
  		
    			true
  		
	
      
    
  
  
    dev
  

你可能感兴趣的:(java开发工具)