zoukankan      html  css  js  c++  java
  • Gradle5.x打jar包上传maven仓库

    1.上传本地仓库

    1.1 build.gradle 项目设置

    plugins {
        id 'java'
        id 'maven' //引入maven插件
    }
    
    group 'com.inkyi' //包名
    version '1.0.1-SNAPSHOT' //版本号

    1.2 build.gradle 上传设置

    // 指定上传的路径
    def localMavenRepo = 'file://' + new File(System.getProperty('user.home'), '.m2/repository').absolutePath
    
    // 上传Task,Gradle会生成并上传pom.xml文件。
    uploadArchives {
        repositories {
            mavenDeployer {
                repository(url: localMavenRepo)//构造项目的Pom文件
                pom.project {
                    name = project.name
                    packaging = 'jar'
                    description = 'description'
                }
            }
    
        }
    }

    1.3 项目根目录执行命令

    Z:xxxxxx>gradle uploadArchives
    
    BUILD SUCCESSFUL in 0s
    3 actionable tasks: 1 executed, 2 up-to-date

    2.上传私有仓库(参考Gradle Plugin文档,没有真正上传过)

    2.1 build.gradle 项目设置和上面的 1.1 一样

    2.2 build.gradle 上传设置

    // 上传Task,Gradle会生成并上传pom.xml文件。
    uploadArchives {
    repositories {
    mavenDeployer {
           //这个地方,多了填写用户名和密码的方法,用来私有仓库的验证
    repository(url: "scp://repos.mycompany.com/releases") {
    authentication(userName: "me", password: "myPassword")
    }
    //构造项目的Pom文件
    pom.project {
    name = project.name
    packaging = 'jar'
    description = 'description'
    }
    }

    }
    }

    2.3 项目根目录执行命令与1.3是一样的

    上传本地仓库的我试过是可以用的,上传私有仓库的还没试过,有不符合的地方,建议参考文档再调整一下。文档地址:https://docs.gradle.org/current/userguide/maven_plugin.html

  • 相关阅读:
    js实现金额千分位显示
    iview中select组件使用总结
    在VUE中使用QRCode.js
    vue echart使用总结
    Iview Table组件中各种组件扩展
    前端架构模式Mvc和Mvvm
    express 中间件
    http与https的区别
    前后端分离与不分离的区别,两者的优势
    TCP三次握手、四次挥手
  • 原文地址:https://www.cnblogs.com/inkyi/p/10469740.html
Copyright © 2011-2022 走看看