문서의 이전 판입니다!
target ( name : target-name ) target-closure target ( name : target-name , description : target-description ) target-closure target ( target-name : target-description ) target-closure
gant -p/-T
옵션에서 타겟의 설명으로 나오게 된다.ant
라는 이름의 AntBuilder 객체의 메소드 이름으로 Ant Task를 호출할 수 있다.target ( flob : 'Some message or other.' ) { // 둘 다 가능 ant.echo ( message : 'Some message.' ) echo ( message : 'Some message.' ) }
target ( adob : 'A target called adob.' ) { flob ( ) //flob 이라는 타겟 호출 }
target ( adob : 'A target called adob.' ) { depends ( flob ) // adob 타겟을 실행하면 그 전에 항상 flob 타겟 호출 }
gant
명령만 실행해도 되는 기본 타겟을 설정할 수 있다.setDefaultTarget ( aTarget )
target ( 'default' : 'aTarget' ) { aTarget ( ) }
Groovy는 기본적으로 Ant와 JUnit을 내장하고 있다. 따라서 Gant는 어떠한 추가 없이 Ant와 JUnit 태스크를 실행할 수 있다. 기타 직접 태스크 라이브러리를 추가하고자 할 때는 다음과 같이 클래스패스를 지정한다.
–classpath <path>
혹은 -P <path>
로 다른 Ant 태스크 jar 클래스패스 추가${user.home}/.ant/lib
에 있는 jar 자동 추가$ANT_HOME/lib
에 있는 jar 자동 추가$GANT_HOME/conf/gant-start.conf
에 따르면 다음 디렉토리들도 자동 클래스패스 추가 대상인듯${user.home}/.gant/lib
${user.home}/.ant/lib
${user.home}/.groovy/lib
${gant.home}/lib
build.gant
는 그 자체가 스크립트이고 target
도 메소드이므로 동적으로 타겟을 생성하는 것이 가능하다.
gant -T
$ gant -T a_project Description for a b_project Description for b c_project Description for c d_project Description for d