mvn 部署、发布等

添加项目的mvn仓库依赖

依赖包:


        
            example_public
            example_public
            http://127.0.0.1:8081/nexus/content/groups/public
            
                true
            
            
                false
            
        
        
            example_snapshots
            example_snapshots
            http://127.0.0.1:8081/nexus/content/repositories/snapshots
            
                false
            
            
                true
            
        
    

mvn插件:


        
            example_public
            example_public Repository
            http://127.0.0.1:8081/nexus/content/groups/public
            default
            
                true
            
        
    

mvn部署snopshot版本的jar

添加远程仓库


        
            example-snapshot-repository
            example Snapshot Repository
            http://127.0.0.1:8081/nexus/content/repositories/snapshots/
        
        
            example-release-repository
            example Release Repository
            http://127.0.0.1:8081/nexus/content/repositories/releases/
        
    

配置mvn的setting文件,右键项目,mvn-->create/open setting.xml会在.m2/路径下创建setting.xml,这里可以配置mvn的各种系统配置,其他的配置百度即可。

# 根据远程仓库的信息配置访问的用户名密码

        
            example-release-repository
            admin
            admin123
        
        
            example-snapshot-repository
            admin
            admin123
        
    

部署项目:

mvn deploy -Dmaven.test.skip=true

一些其他指令:

  • 部署指定jar包,注意这种方式不会部署jar包的相关依赖!!

mvn deploy:deploy-file -DgroupId=com.example.xxx.yyy -DartifactId=xxx-xxx-xxx -Dversion=1.1-SNAPSHOT -Dpackaging=jar -Dfile=xxx-xxx-xxx-1.1-SNAPSHOT.jar -Durl=http://admin:[email protected]:8081/nexus/content/repositories/snapshots/
  • 使用指定的setting.xml部署
mvn deploy -Dmaven.test.skip=true -s C:\Users\chang\.m2\repository\setting.xml

你可能感兴趣的:(mvn 部署、发布等)