Sonatype Nexus Repository Manager 搭建maven 私仓

前言

下载安装  Nexus Repository Manager      默认账号/密码  :   admin/admin123   视版本而定,这里安装不做深究,主要对如何配置maven 私仓  和  idea 中 deploy  jar 包 进行记录。

0.首先创建   四个Repository 对应的各个Repository 的 type  需要注意。

group(仓库组)、hosted(宿主仓库)、proxy(代理仓库)

Sonatype Nexus Repository Manager 搭建maven 私仓_第1张图片

1.maven-central:         type 为  proxy   意为 仓库中没有对应的jar 包是需要去远程   仓库下载。我这在创建的时候  proxy   填的是阿里的 http://maven.aliyun.com/nexus/content/groups/public/   国内仓库快些。

Sonatype Nexus Repository Manager 搭建maven 私仓_第2张图片

Sonatype Nexus Repository Manager 搭建maven 私仓_第3张图片

2.maven-public:          type  为  group  其中包含一些其他的仓库配置时可选    选定想要的仓库组组成。

 

Sonatype Nexus Repository Manager 搭建maven 私仓_第4张图片

3.maven-releases   和 maven-snapshots   type   为  host     他们俩的区别在于   里边的权限分别为

Sonatype Nexus Repository Manager 搭建maven 私仓_第5张图片Sonatype Nexus Repository Manager 搭建maven 私仓_第6张图片

之后就需要配置maven 的settings.xml  

1.配置私仓地址 

 

    
        nexus 
        *    
        Nexus saic  
        http://localhost:8081/repository/*-public/  
    

 

 

2.配置私仓的用户名密码 。这里需要记住这个id   之后的maven  项目中的pom.xml  需要使用

    
      nexus
      admin
      admin123
    

这里需要记住这个id

3.配置profile


      nexus
      
           
              snapshots
              http://localhost:8081/repository/*-snapshots/
              true
              true
            
            
              releases
              http://localhost:8081/repository/*-releases/
              true
              true
            
      
      
            
              snapshots
              http://localhost:8081/repository/*-snapshots/
              true
              true
            
            
              releases
              http://localhost:8081/repository/*-releases/
              true
              true
            
      
    

 

 

4.启用对应id的这个profile

    
        
        nexus
    

 

配置  maven  项目中的  pom.xml   添加

这其中的id   就需要和上边的settings.xml  中的server   节点的 id对应上。找到对应的用户名密码


  
    nexus
    releases
    http://localhost:8081/repository/*-releases/
  
  
    nexus
    snapshots
    http://localhost:8081/repository/*-snapshots/
  

注意:

deploy  snapshots  需要  1.0.1-RELEASE

deploy releases  需要   1.0.1-SNAPSHOT

如有问题请留言。

你可能感兴趣的:(工具,spring-cloud,OSS)