ubuntu安装配置nexus maven私服,以及maven pom.xml配置

1、下载nexus

wget https://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-3.18.1-01-unix.tar.gz

或者前往官网下载最新的安装包

https://www.sonatype.com/

Professional Edition为收费版,OSS Edition为免费版。笔者下载使用的是OSS Edition。

2、启动nexus

解压安装包后,进入bin目录,执行:

sudo ./nexus run

程序启动后,可以访问web界面:

localhost:8081

3、配置nexus为系统服务

创建配置文件:

sudo vim /etc/systemd/system/nexus.service

写入:

[Unit]
Description=nexus service
After=network.target

[Service]
Type=forking
ExecStart=/home/nexus-3.18.1-01/bin/nexus start
ExecStop=/home/nexus-3.18.1-01/bin/nexus stop
User=root
Restart=on-abort

[Install]
WantedBy=multi-user.target

启动服务:

systemctl daemon-reload
systemctl enable nexus.service
systemctl start nexus.service

4、几种Repository

ubuntu安装配置nexus maven私服,以及maven pom.xml配置_第1张图片

hosted:宿主仓库,用于发布内部项目,比如内部jar等;

proxy:代理仓库,可以代理maven中央仓库,阿里云镜像仓库等;

group:仓库组合,可以聚合多个hosted和group仓库

 

5、settings.xml配置



  
  
  
   
     
      Release  
      admin  
      nexus3-1001 
      
     
      Snapshot  
      admin  
      nexus3-1001 
     
  
  
  
  
    
      Release
      *
      http://xxx.xxx.xxx.xxx:8081/repository/maven-public/
    
	
      Snapshot
      *
      http://xxx.xxx.xxx.xxx:8081/repository/maven-public/
    
  
  
  
   
     
      coder 
	  
       
         
          MyGroup  
          http://xxx.xxx.xxx.xxx:8081/repository/maven-public/  
           
            true
			always
            
           
            true  
            always 
           
         
      
	  
	  
          
            MyGroup
            http://xxx.xxx.xxx.xxx:8081/repository/maven-public/ 
            
				true
				always
			
            
				true
				always
			
          
     
	  
       
        true  
        1.8 
        
       
        1.8  
        1.8  
        1.8 
       
      
  
  
  
	coder
  
  

 

6、maven pom.xml配置

	
	
		
			Release
			RELEASE
			http://xxx.xxx.xxx.xxx:8081/repository/maven-releases/
		
		
			Snapshot
			SNAPSHOOT
			http://xxx.xxx.xxx.xxx:8081/repository/maven-snapshots/
		
	

	
	
		
			MyGroup
			MyGroup
			http://xxx.xxx.xxx.xxx:8081/repository/maven-public/
			
				true
			
			
				true
			
		
	

	
	
		
			MyGroup
			http://xxx.xxx.xxx.xxx:8081/repository/maven-public/
		
	

 

你可能感兴趣的:(ubuntu,maven,nexus)