문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
gant:antlib [2012/10/22 18:15] kwon37xi |
gant:antlib [2012/10/22 18:49] (현재) kwon37xi [기타 AntLib 지원 라이브러리들] |
||
---|---|---|---|
줄 1: | 줄 1: | ||
====== Gant Ant Libraries ====== | ====== Gant Ant Libraries ====== | ||
- | TODO | + | * [[http:// |
+ | * 태스크 이름 충돌이 발생하지 않도록 네임스페이스 지정 기능을 가지고 있다. | ||
* [[http:// | * [[http:// | ||
- | * [[http:// | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
- | | + | |
+ | |||
+ | ===== 직접 호출 방식 ===== | ||
+ | AntUnit의 태스크들이 '' | ||
+ | <code groovy> | ||
+ | // 파일이 존재하지 않음(assertFileDoesntExist)을 확인 | ||
+ | ant.' | ||
+ | |||
+ | ant.copy(file:' | ||
+ | // 이제 파일이 존재함(assertFileExists)을 확인 | ||
+ | ant.' | ||
+ | |||
+ | ant.delete(file:' | ||
+ | ant.' | ||
+ | </ | ||
+ | |||
+ | ===== antlib를 기본 네임스페이스로 가져오기 ===== | ||
+ | 자신만의 네임스페이스에 있던 antlib 태스크들을 기본 네임스페이스로 가져와서 '' | ||
+ | |||
+ | <code groovy> | ||
+ | import org.apache.tools.ant.taskdefs.Antlib | ||
+ | |||
+ | // AntUnit 태스크 설정정보 파일 읽기 | ||
+ | def url = this.class.getResource(' | ||
+ | // AntUnit의 태스크들을 현재 네임스페이스(ant.*)로 가져옴 | ||
+ | Antlib.createAntlib(ant.antProject, | ||
+ | |||
+ | target(antunittest: | ||
+ | // AntUnit의 태스크 바로 실행 | ||
+ | assertFileDoesntExist(file:' | ||
+ | |||
+ | copy(file:' | ||
+ | assertFileExists(file:' | ||
+ | |||
+ | delete(file:' | ||
+ | assertFileDoesntExist(file:' | ||
+ | |||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== 독립 네임스페이스로 가져오기 ===== | ||
+ | 모든 태스크를 ant 기본 네임스페이스로 가져오면 태스크 이름의 충돌이 발생할 가능성이 높아진다. 이 이름 충돌을 방지하면서 여러 태스크를 정의하는 것이 AntLib의 기본적인 목적이다. | ||
+ | AntUnit을 '' | ||
+ | |||
+ | 이 방법을 권장한다. 가능하면 이 방법으로 AntLib 태스크들을 사용하는 것이 좋다. | ||
+ | |||
+ | <code groovy> | ||
+ | import groovy.xml.NamespaceBuilder | ||
+ | |||
+ | // 네임스페이스 정의 | ||
+ | // 자동으로 antlib: 뒤에있는 패키지경로에서 antlib.xml을 읽는 것 같음. | ||
+ | // 즉, 여기서는 org/ | ||
+ | def antunit = NamespaceBuilder.newInstance(ant, | ||
+ | |||
+ | target(antunittest: | ||
+ | // AntUnit의 태스크 바로 실행 | ||
+ | antunit.assertFileDoesntExist(file:' | ||
+ | |||
+ | ant.copy(file:' | ||
+ | antunit.assertFileExists(file:' | ||
+ | |||
+ | ant.delete(file:' | ||
+ | antunit.assertFileDoesntExist(file:' | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== 기타 AntLib 지원 라이브러리들 ===== | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// |