上传组件jar和源码到maven仓库


操作

在父级pom中添加


        
            sge//这个位置的id需要和maven的settings.xml文件中想匹配
            gitlab-runner//这个name是maven上传jar包到仓库的用户名
            http://180.2.35.50:8081/repository/maven-snapshots/
        
        
            sge-release
            gitlab-runner
            http://180.2.35.50:8081/repository/maven-releases/
        
    


   
      
          org.apache.maven.plugins
          maven-source-plugin
          3.0.1
          
             true
          
             
                 
                     compile
                         
                            jar
                         
                 
            
        
    

在子模块中添加


          org.apache.maven.plugins
          maven-source-plugin

maven的settings.xml中配置server的信息


    
      sge
      gitlab-runner//这里的用户名和密码是登录maven仓库(Nexus)的,具有上传jar包的权限。
      gitlab-runner
    
  

验证

使用IDEA或者命令行执行 mvn deploy

打开远程仓库,查看你项目所在的snapshots或者release目录下,找到那个jar包,
看看是否有个xxxx-snapshots-sources.jar 的包。如果有就成功了。

如果在执行部署的时候失败了,那多半是因为你的账户名不对。

参考:https://maven.apache.org/pom.html#Repositories
https://maven.apache.org/settings.html

相关