mvn repository|mvn deploy部署到nexus的教程详解

更新时间:2020-09-08    来源:安装和部署    手机版     字体:

【www.bbyears.com--安装和部署】

在使用maven构建模块化项目时,将项目打包发布到中央仓库是很频繁的操作,通过配置可以简化这个过程。

settings.xml配置账号密码


   
        deploymentRepo
        admin
        admin123
   

   
        snapshots
        admin
        admin123
   


直接部署jar包

mvn deploy:deploy-file -DgroupId=com.renhenet -DartifactId=renhesoa-api -Dversion=1.0.0 -Dpackaging=jar -Dfile=target/renhesoa-api-1.0.0.jar -Durl=http://localhost:8083/content/repositories/thirdparty/ -DrepositoryId=deploymentRepo

DrepositoryId即setting.xml中得server.id

使用deploy插件


    org.apache.maven.plugins
    maven-deploy-plugin
    2.7

添加deploy插件后,执行mvn deploy会报错,如下:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project renhesoa-api: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]

提示还需配置distributionManagement,指定DaltDeploymentRepository,如下:


  
      deploymentRepo
      Nexus Renhe
      http://localhost:8083/content/repositories/thirdparty/
  


添加源码插件,同步发布源码包


    maven-source-plugin
    2.4
   
       
            package
           
                jar-no-fork
           

       

   

本文来源:http://www.bbyears.com/asp/97432.html

热门标签

更多>>

本类排行