2009-05-08 7 views
46

Git을 Ant와 통합하는 가장 좋은 방법을 찾고 있습니다. Git에 널리 사용되는 Ant 태스크가 있습니까? 누구든지 개미 (예 : 전용 작업, 임원 호출 등)를 통해 힘내를 사용하여 어떤 경험이 있습니까?개미와 개미를 통합하는 가장 좋은 방법은?

+2

더 자세한 질문은 http://stackoverflow.com/questions/2974106/how-to-lookup-the-latest-git-commit-hash-from-an-ant-build-script를 참조하십시오. 거기에 대한 답이 도움이 될 수도 있습니다. – koppor

답변

19

Git을위한 Ant 작업 세트가없는 것처럼 보입니다.

This blog 힘내 주를위한 몇 가지 기본 작업에 대해 이야기합니다.

+1

여기에 Jit을 통한 Git Ant Tasks가 있습니다. http://aniszczyk.org/2011/05/12/git-ant-tasks-via-jgit/ –

+0

이 명령은'git clone','git init' 및'git checkout '. – zb226

+1

블로그가 구식입니다. 블로그 링크 –

21

개미는 명령어 (Git 포함)를 실행하기 위해 명령 줄에 전달하는 데 사용할 수있는 exec command을 지원합니다. 당신은 언제나 그걸 잊어 버릴 수 있습니다.

6

Look at JGit-Ant. 불행히도 jgit-ant 작업 프로젝트는 모든 주요 git 조치가 아니며 추가 정보 here을 찾을 수 있습니다.

자바 개발자의 경우 this examples과 같이 jgit을 사용하여 git-ant-commands를 쉽게 작성할 수 있습니다.

+0

링크가 깨졌습니다. – Valentino

0

일부 <script language="javascript"> 코드와 JGit 라이브러리의 조합을 사용합니다 (Rhino lubrary를 사용했지만 Groovy 등을 동일하게 사용할 수 있음).

0

시간 전 Git과 Ant를 통합하는 데 사용할 수있는 방법을 찾지 못했습니다. 나는 Git 브랜치의 이름으로 빌드를 생성 할 필요가 있었다.

실제 build.xml 파일에서 발췌 : 마지막으로 나는 다음과 같은 솔루션에 온

<target name="-check-git-branch-name" 
    if="using.git" 
    > 
    <exec executable="bash" logError="true" failonerror="true" 
     outputproperty="git-branch-name"> 
     <arg value="./bin/git-branch-name.sh" /> 
    </exec> 
</target> 

파일 ./bin/git-branch-name.sh

#!/bin/bash 

# This script is the part of integration GIT to ANT. Once launched it 
# should return the name of the current branch or the current commit (if 
# GIT is the detached HEAD mode). Further the printed name is appended to 
# the name of the resulting directory. To initialize this feature you need 
# to run ANT with the option "-Dusing.git=". 

exec 2>/dev/null 

git rev-parse --abbrev-ref HEAD | grep -v HEAD || git rev-parse HEAD 

호출의 전체 내용이 유사합니다

ant TARGET options -Dusing.git= 

${using.git}이 de clared의 경우, Ant는 작업 이름 -check-git-branch-name을 호출하여 분기 이름 (또는 Git이 분리 모드 인 경우 커밋 번호)을 수집하고 Git 분기 이름 (또는 커밋의 h 번호)이 추가 된 빌드 (예 : build/TARGET-${git-branch-name})를 생성합니다.

관련 문제