【发布时间】: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版本?
【问题讨论】: