【问题标题】:Creating/Pushing a tag for a private repository using gradle git plugin使用 gradle git 插件为私有存储库创建/推送标签
【发布时间】:2016-01-11 17:56:25
【问题描述】:

我想创建一个标签并将其推送到我的 git 存储库(私有)。 目前,我的 build.gradle 看起来像这样

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.3.0'
    classpath "org.ajoberstar:grgit:1.3.0"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}     

 allprojects {
repositories {
    jcenter()
}
}

我有一项任务是克隆存储库:

task cloneTest <<{
def myRepo = org.ajoberstar.grgit.Grgit.clone(dir: 'C:\\Rep1', uri: 'https://bitbucket.org/..)

 }

现在,我想添加另一个任务来为私有 GitHub 存储库创建/推送标签,我已经通过此链接 http://ajoberstar.org/grgit/docs/groovydoc/org/ajoberstar/grgit/operation/TagAddOp.html 但我无法在我的 gradle 文件中使用它。目前我是这样写的

task createTag <<{
def grgit = org.ajoberstar.grgit.Grgit.open(dir: 'C:\\Rep1')
grgit.tag.add(name: 'new-Tag', message: 'Some Message!')
}

此解决方案在http://ajoberstar.org/grgit/docs/groovydoc/org/ajoberstar/grgit/operation/TagAddOp.html 中给出。但这表示“无法解决添加”。我不知道出了什么问题。是不是我需要改的grgit版本?

【问题讨论】:

    标签: github gradle


    【解决方案1】:

    这行得通:

    task createTag <<{                                                      
    def grgit = org.ajoberstar.grgit.Grgit.open(dir: 'dir_loc')        
    grgit.tag.add(name: 'new-Tage', message: 'Some Message!')           
    grgit.push(tags: true)                                              
    }                                                                       
    

    我可以在 bitbucket 中看到我的标签

    我正在使用类路径 'org.ajoberstar:grgit:1.3.0' 。它在添加和推送关键字时显示错误,但是当我在 cli 上运行任务时它运行成功。所以,这完全没问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-01
      • 2013-09-10
      • 2019-08-30
      • 1970-01-01
      • 2011-07-08
      • 2011-05-05
      • 2013-07-28
      • 1970-01-01
      相关资源
      最近更新 更多