48、Maven学习(CentOS7搭建Nexus3.2.1私服2017年3月)

Centos7搭建Nexus3

Nexus官方网站:https://www.sonatype.com/download-oss-sonatype

下载unix 的tar.gz版本即可

当前版本为3.2.1


48、Maven学习(CentOS7搭建Nexus3.2.1私服2017年3月)_第1张图片

解压后得到两个文件夹

tar -zxvf nexus-3.2.1-01-unix.tar.gz

我们进入 nexus-3.2.1-01文件夹

然后进入bin目录

48、Maven学习(CentOS7搭建Nexus3.2.1私服2017年3月)_第2张图片


查看nexus.vmoptions

48、Maven学习(CentOS7搭建Nexus3.2.1私服2017年3月)_第3张图片


在里面我们可以按照实际情况设置参数

其中 -Dkaraf.data和-Djava.io.tmpdir这两个参数 是存放jar包的路径


48、Maven学习(CentOS7搭建Nexus3.2.1私服2017年3月)_第4张图片

我们可以在/etc/profile 中写入nexus_home ,那就无需进入bin目录才启动nexus了

48、Maven学习(CentOS7搭建Nexus3.2.1私服2017年3月)_第5张图片


修改完后 记得 source /etc/profile


启动Nexus:

nexus start 或者  nexus 

关闭Nexus

nexus stop

需要注意,nexus默认端口是8081

我们要开启一下8081端口

firewall-cmd --zone=public --add-port=8081/tcp --permanent  

然后重启一下防火墙

systemctl restart firewalld.service  

值得留意的是

启动了nexus需要等待一会才能访问。

需要稍等一段时间,8081端口才起来


http://localhost:8081

默认用户名:admin

默认密码 admin123


然后,在你的本地的Maven中修改setting.xml

加入如下内容



  
    org.sonatype.plugins
  

 
    
      nexus
      admin
      admin123
    
  


    
      nexus
      *
      http://localhost:8081/repository/maven-public/
    
    

  



      nexus
      
        
          central
          http://central
          true
          true
        
      
     
        
          central
          http://central
          true
          true
        
      
    

  
  
    nexus
  

在您的工程pom文件中加入


  
      nexus
      Releases
      http://localhost:8081/repository/maven-releases
    
    
      nexus
      Snapshot
      http://localhost:8081/repository/maven-snapshots
    
  



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

最后eclipse中发布

项目右单击->Run As->Maven build.. ->deploy -e 

则可以在nexus中看到我们发布的项目了。


最后,查阅了很多资料,都没成功地完成开机自动启动nexus3.2.1

网上基本是文章一大抄的都是旧版本的nexus

对centos并不是十分熟悉,暂且放下,待日后了解足够再回来补全。

希望其他读者知道的,也留言个方法,谢谢


其他网上参考资料如下:

http://www.cnblogs.com/kevingrace/p/6201984.html

http://blog.csdn.net/typa01_kk/article/details/49228873

http://blog.csdn.net/yamaxifeng_132/article/details/52479891

http://blog.csdn.net/clj198606061111/article/details/52200928

你可能感兴趣的:(Maven学习,centos学习)