使用gradle git插件创建/推送专用存储库的标签 [英] Creating/Pushing a tag for a private repository using gradle git plugin

查看:813
本文介绍了使用gradle git插件创建/推送专用存储库的标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to create a tag and push it to my git repository(private). Currently, my build.gradle looks like this

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()
}
}

我有一个任务克隆存储库:

and I have one task to clone repository :

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文件中使用它。目前我正在写这样的文章。

Now, I want to add another task to create/Push a tag for a private GitHub repository and I have gone through this link http://ajoberstar.org/grgit/docs/groovydoc/org/ajoberstar/grgit/operation/TagAddOp.html But I am unable to use this in my gradle file. Currently I am writing like this

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版本?

This solution is given in http://ajoberstar.org/grgit/docs/groovydoc/org/ajoberstar/grgit/operation/TagAddOp.html. But this says 'add cannot be reolved'. I don't know what is wrong. Is it with the grgit version I need to change?

推荐答案

此工作:

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中看到我的标签

I am able to see my tags in bitbucket

我正在使用classpath'org.ajoberstar:grgit: 1.3.0'。它显示添加和推送关键字的错误,但当我在cli上运行任务时,它会成功运行。所以,这完全正常

I am using classpath 'org.ajoberstar:grgit:1.3.0' . It shows error on add and push keywords but it runs successfully when I run the task on cli. So, this works completely fine

这篇关于使用gradle git插件创建/推送专用存储库的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆