Rimersolution ANT Git插件

时间:2015-01-29 22:03:15

标签: git ant jgit

在从Git云存储库中检出代码时遇到问题。

这是ANT构建代码

  <project name="ProjectX" default="checkoutcode" basedir="."  xmlns:git="antlib:com.rimerosolutions.ant.git">
<taskdef uri="antlib:com.rimerosolutions.ant.git"
         resource="com/rimerosolutions/ant/git/jgit-ant-lib.xml">
        <classpath>
            <pathelement location="./external-libs/org.eclipse.jgit.ant-3.0.0.201306101825-r.jar"/>
            <pathelement location="./external-libs/org.eclipse.jgit-3.0.0.201306101825-r.jar"/>
            <pathelement location="./external-libs/jsch-0.1.50.jar"/>
            <pathelement location="./external-libs/ant-git-tasks-0.0.1.jar"/>

       </classpath>
  </taskdef>

    <git:settings refId="git.testing"
        username="userx"
        password="passx"
        name="Rashmin"
        email="r@r.com"/>

    <target name="checkoutcode">
   <git:git directory="c:\documents\projectxsrcbuild" verbose="true" settingsRef="git.testing">
            <git:init uri="https://github.com/company/projectx.git" />
            <git:checkout branchname="development" />

        </git:git>
    </target>
     </project>

这是我在控制台上得到的结果

Buildfile: C:\document\git\Platform\build\buildprojectx.xml

check:

init:
   [delete] Deleting directory c:\documents\projectxsrcbuild
    [mkdir] Created dir: c:\documents\projectxsrcbuild

checkoutcode:
[antlib:com.rimerosolutions.ant.git:checkout] The branch 'development' was not found.

任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

我更熟悉JGit,它有一个关联的ant任务。

也可从Maven Central存储库获取:

不完全清楚你的ANT任务是什么,虽然看看jar依赖,看起来它也取决于JGit。

我对JGit的ANT使用示例:

  1. How to tell ANT-exec, the location of git executable
  2. How can I get the latest commit ID of the currently checked out branch in git, using ANT, without having an active git installation?