사용자 도구

사이트 도구


gant:antlib

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
마지막 판 양쪽 다음 판
gant:antlib [2012/10/22 18:34]
kwon37xi
gant:antlib [2012/10/22 18:47]
kwon37xi
줄 44: 줄 44:
 } }
 </code> </code>
 +
 +===== 독립 네임스페이스로 가져오기 =====
 +모든 태스크를 ant 기본 네임스페이스로 가져오면 태스크 이름의 충돌이 발생할 가능성이 높아진다. 이 이름 충돌을 방지하면서 여러 태스크를 정의하는 것이 AntLib의 기본적인 목적이다.
 +AntUnit을 ''antunit'' 네임스페이스로 선언하여 사용할 수 있다.
 +
 +이 방법을 권장한다. 가능하면 이 방법으로 AntLib 태스크들을 사용하는 것이 좋다.
 +
 +<code groovy>
 +import groovy.xml.NamespaceBuilder
 +
 +// 네임스페이스 정의
 +// 자동으로 antlib: 뒤에있는 패키지경로에서 antlib.xml을 읽는 것 같음.
 +// 즉, 여기서는 org/apache/ant/antunit/antlib.xml
 +def antunit = NamespaceBuilder.newInstance(ant, 'antlib:org.apache.ant.antunit')
 +
 +target(antunittest: 'AntUnit Test') {
 +    // AntUnit의 태스크 바로 실행
 +    antunit.assertFileDoesntExist(file:'copytest1.tmp')
 +
 +    ant.copy(file:'src/some/HelloWorld.groovy', tofile:'copytest1.tmp')
 +    antunit.assertFileExists(file:'copytest1.tmp')
 +     
 +    ant.delete(file:'copytest1.tmp')
 +    antunit.assertFileDoesntExist(file:'copytest1.tmp')
 +}
 +</code>
 +
 +===== 기타 AntLib 지원 라이브러리들 =====
 +  * [[http://ant.apache.org/antlibs/proper.html|Apache 기본 제공 AntLib들]]
 +  * [[http://maven.apache.org/ant-tasks/index.html|Maven Ant Tasks]] : Maven의 의존성 관리를 Ant에서 사용할 수 있게 해주는 AntLib
 +  * [[http://ant.apache.org/ivy/|Apache Ivy]] : Ivy는 Ant용 의존성 관리 시스템
 +
gant/antlib.txt · 마지막으로 수정됨: 2012/10/22 18:49 저자 kwon37xi