Maven 私服 自动上传部署(附快速镜像)

一、配置Maven的 settings.xml

 nexus私服是需要登陆的(可配置免登陆),在settings.xml的配置

如下:


	   
		nexus   
		admin
		xxxxx   
	
	   
		central   
		admin   
		xxxx   
	

二、 配置项目的 pom.xml

添加如下:

  
   
    nexus
    Internal Releases
    http://168.10.132.150:8081/nexus/content/repositories/thirdparty/
   
  

三、其它问题

请确保 maven 私服开启了上传部署策略:

1.登录到maven私服,点击“Repositories”在右侧的列表中找到要使用的私服仓库,最右侧为仓库地址(复制这个地址,私服镜像和上传都要用到)

2.点击该仓库后,在下面找到“Configuration”标签页,找到“Deployment Policy”项,将其修改为:Allow Redeploy

3.点击最下面的“Save”保存配置即可,之后在项目根目录下运行命令:mvn deploy


mvn deploy:会自动编译、打包、上传构件到私服,整个过程一键搞定!!


附件:

经常使用的几个比较快的镜像:


    
	
		nexus
		nexus
		http://168.10.132.150:8081/nexus/content/groups/public/
	
	
	 
        repo2
        central
        Human Readable Name for this Mirror.
        http://repo2.maven.org/maven2/
    
    
    
        ui
        central
        Human Readable Name for this Mirror.
        http://uk.maven.org/maven2/
    
    
        ibiblio
        central
        Human Readable Name for this Mirror.
        http://mirrors.ibiblio.org/pub/mirrors/maven2/
    
	
		alimaven
		aliyun maven
		http://maven.aliyun.com/nexus/content/groups/public/
		central 
	
	
	
		repo1
		central
		
		https://repo1.maven.org/maven2/
	
	
		sprintio
		central
		Human Readable Name for this Mirror.
		https://repo.spring.io/libs-snapshot/
	
    
        jboss-public-repository-group
        central
        JBoss Public Repository Group
        http://repository.jboss.org/nexus/content/groups/public
    
  


你可能感兴趣的:(Maven)