如何分辨ANT-EXEC,git的可执行文件的位置 [英] How to tell ANT-exec, the location of git executable
本文介绍了如何分辨ANT-EXEC,git的可执行文件的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从ANT运行git克隆。但是好像蚂蚁无法找到的git可执行文件。我曾尝试以下选项。
< EXEC可执行=/选择/免费软件/斌/混帐>< EXEC可执行=的/ usr / bin中/混帐>< EXEC可执行=混帐>
解决方案
一个更强大的选择是使用 jgit Ant任务:
<项目名称=演示默认为克隆> <目标名称=引导>
< MKDIR DIR =$ {}的user.home /蚂蚁/ lib目录下。/>
<获得DEST =$ {}的user.home /蚂蚁/ lib目录/ jgit.jar src=\"http://search.maven.org/remotecontent?filepath=org/eclipse/jgit/org.eclipse.jgit/3.1.0.201310021548-r/org.eclipse.jgit-3.1.0.201310021548-r.jar\"/>
<获得DEST =$ {}的user.home /蚂蚁/ lib目录/ jgit.ant.jar src=\"http://search.maven.org/remotecontent?filepath=org/eclipse/jgit/org.eclipse.jgit.ant/3.1.0.201310021548-r/org.eclipse.jgit.ant-3.1.0.201310021548-r.jar\"/>
<获得DEST =$ {}的user.home /蚂蚁/ lib目录/ jsch.jarSRC =http://search.maven.org/remotecontent?filepath=com/jcraft/jsch/0.1.50/jsch -0.1.50.jar/>
< /目标与GT; <目标名称=克隆>
<的taskdef资源=组织/日蚀/ jgit / ANT / ant-tasks.properties/>
<混帐克隆URI =https://github.com/myproject/myrepo.git目标=建立/ myrepo分支=主/>
< /目标与GT; <目标名称=干净>
<删除DIR =构建/>
< /目标与GT;< /项目>
注:
- 在引导的任务将下载jgit罐子。只需要一次运行。
I am trying to run git clone from ANT. But seems like ANT is not able to find git executable. I have tried following options.
<exec executable="/opt/freeware/bin/git">
<exec executable="/usr/bin/git">
<exec executable="git">
解决方案
A more robust option is to use the jgit ANT task:
<project name="demo" default="clone">
<target name="bootstrap">
<mkdir dir="${user.home}/.ant/lib"/>
<get dest="${user.home}/.ant/lib/jgit.jar" src="http://search.maven.org/remotecontent?filepath=org/eclipse/jgit/org.eclipse.jgit/3.1.0.201310021548-r/org.eclipse.jgit-3.1.0.201310021548-r.jar"/>
<get dest="${user.home}/.ant/lib/jgit.ant.jar" src="http://search.maven.org/remotecontent?filepath=org/eclipse/jgit/org.eclipse.jgit.ant/3.1.0.201310021548-r/org.eclipse.jgit.ant-3.1.0.201310021548-r.jar"/>
<get dest="${user.home}/.ant/lib/jsch.jar" src="http://search.maven.org/remotecontent?filepath=com/jcraft/jsch/0.1.50/jsch-0.1.50.jar"/>
</target>
<target name="clone">
<taskdef resource="org/eclipse/jgit/ant/ant-tasks.properties"/>
<git-clone uri="https://github.com/myproject/myrepo.git" dest="build/myrepo" branch="master"/>
</target>
<target name="clean">
<delete dir="build"/>
</target>
</project>
Notes:
- The "bootstrap" task will download the jgit jars. Only needs to be run once.
这篇关于如何分辨ANT-EXEC,git的可执行文件的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文