发布Maven包到私服

 

      一. maven setting.xml中配置私服server信息:      

    
      releases
      admin
      admin123456
    

    
      snapshots
      admin
      admin123456
    

 二. 发布配置或命令

 ① 命令式: 

  分别发布稳定版本和快照版本(判断依据是所创建Maven版本是否依-SNAPSHOT结尾)。

mvn deploy:deploy-file -Dfile=target/springfox-swagger-ui-shade.jar -DgroupId=rz.springfox -DartifactId=springfox-swagger-ui-shade -Dversion=2.9.2 -Dpackaging=jar -DrepositoryId=releases -Durl=http://maven.xxx.com/nexus/content/repositories/releases/
mvn deploy:deploy-file -Dfile=target/springfox-swagger-ui-shade.jar -DgroupId=rz.springfox -DartifactId=springfox-swagger-ui-shade -Dversion=2.9.2 -Dpackaging=jar -DrepositoryId=snapshots -Durl=http://maven.xxx.com/nexus/content/repositories/snapshots/

 注意:

 repositoryId 需与server的id名称保持一致。

 如遇到401权限问题,检查私服地址和server中配置的用户名密码是否正确。

② 配置文件式:

pom.xml

 
 	
 	    
 	        releases
	        Nexus Release Repository
	        http://maven.xxx.com/nexus/content/repositories/releases/
 	    
	    
	        snapshots
	        Nexus Snapshot Repository
	        http://maven.xxx.com/nexus/content/repositories/snapshots/
	    
	

在IDE中右键运行(mvn) deploy -e 即可。

另: 

    将自定义maven jar包安装到本地命令(根据情况两者二选一):    

mvn install:install-file -Dfile=target/springfox-swagger-ui-shade-2.9.2.jar -DgroupId=ck.springfox -DartifactId=springfox-swagger-ui-shade -Dversion=2.9.2 -Dpackaging=jar
mvn install:install-file -Dfile=target/springfox-swagger-ui-shade-2.9.2-SNAPSHOT.jar -DgroupId=ck.springfox -DartifactId=springfox-swagger-ui-shade -Dversion=2.9.2-SNAPSHOT -Dpackaging=jar

  完整setting.xml文件供参考:







  
 D:\repository
  

  

  
  
    
  

  
  
    
  

  
  
    
    
      releases
      admin
      admin123456
    

    
      snapshots
      admin
      admin123456
    
   

    
  

  
  
    
	 
	   
	  
  

  
  
    
	
      dev

      
		true
        1.8
      

      
			1.8
			1.8
			1.8
	  
	  
	  
         
            releases
            nexus
            http://maven.xxx.com/nexus/content/groups/public/
            
                true
            
            
                true
            

        

        
            3rd.nexus
            thirdparty central mirror
            http://maven.xxx.com/nexus/content/repositories/thirdparty/
			  
                true
            
            
                true
            
        
		
			
      

         
		      
		       releases
	           nexus
	           http://maven.xxx.com/nexus/content/groups/public/
	          
                true
            
            
                true
            
		      
	     	  
	  
    

	
	
	     gfcentral
         
			
			  repo1
			  repo1 repository
			  default
			  http://repo1.maven.org/maven2/
			  
				false
			  
			
		  
    	
	
		
		  alicentral
		  
			
			  ali
			  ali repository
			  http://maven.aliyun.com/nexus/content/groups/public/
			  
			       true
		      
			  
			       true
		      
			
		  
	   
    
  

  
   
      dev
  

  

 其它发布私服教程推荐

 

 

 

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