Nexus 3.0私服搭建及Maven配置

Nexus 私服搭建

Nexus官网

  1. 下载安装包 wgethttps://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-3.9.0-01-unix.tar.gz

  2. 解压到/usr/local/nexus目录下tar -xzvf nexus-3.9.0-01-unix.tar.gz -C nexus

  3. 修改配置文件

  • 修改访问的端口,域

    • vi /usr/local/nexus/nexus-3.9.0-01/etc/org.sonatype.nexus.cfg

    • application-port=yourport

    • nexus-context-path=/nexus

  • 修改所需要的Java环境

    • vi /usr/local/nexus/nexus-3.9.0-01/bin/nexus

    • 增加参数:INSTALL4J_JAVA_HOME_OVERRIDE=/usr/java/jdk1.8.0_131(Java1.8路径,通过$JAVA_HOME命令可以查看Java路径)

  1. 修改使用的用户

    • vi /usr/local/nexus/nexus-3.9.0-01/bin/nexus.rc

    • 添加配置 run_as_user=root

5.启动/关闭/重启nexus服务

  • ./nexus start/stop/restart

nexus后台访问地址:http://yourip:yourport/nexus

默认用户名:admin

默认密码:admin123


maven私服配置测试

  1. 配置pom.xml

           
    
        org.apache.maven.plugins
        maven-surefire-plugin
        
        true
        
    
            
                org.apache.maven.plugins
                maven-compiler-plugin
                3.3
                
                    1.8
                    1.8
                
            
        
    


        
            nexus
            Releases
            http://yourip:yourport/nexus/repository/maven-releases
        
        
            nexus
            Snapshot
            http://yourip:yourport/nexus/repository/maven-snapshots
        

  1. 配置maven settings.xml

    
      nexus
      admin
      admin123
    
  

      nexus
      *
      http://http://yourip:yourport/nexus/repository/maven-public/
    
  1. mvn clean
    mvn deploy
    可以在Browse目录下看到上传的依赖。

参考链接:
http://blog.csdn.net/smartbetter/article/details/55116889
https://www.cnblogs.com/grey-wolf/p/6481166.html
http://blog.csdn.net/clj198606061111/article/details/52200928
https://www.linuxidc.com/Linux/2016-08/134617.htm

你可能感兴趣的:(Nexus 3.0私服搭建及Maven配置)