ANT

ANT

기존에 일일이 했던 컴파일 및 배포 작업들을 script 하나 작성하는것만으로 해결해주는 좋은 도구이다.

war file 같은것을 만들 때는 project name을 참고하고 현재는 그냥 cmd에 ant -buildfile text.xml 이라고 쳤을때 기본으로 another target이 실행 된다. 하지만 another은 test에 depend함으로 test가 먼저실행되어서 hello world가 출력되게 된다.

basedir는 target들이 실행되는 기준이 되는 directory이다.

test_build.properties에는 somename=somevalue 이 한줄 적혀 있다. 굳이 파일 안만들고 안에다 직접 써도 상관은 없다.

src/test/HelloWorld.java 를 컴파일하고 실행하는 스크립트다. pathelement path 와 classname에서 package 이름도 들어가야함을 유의하자

위의 path의 경우는 system variable에서 CLASSPATH를 지정해주는것과 같지만 아래의 fileset의 경우 lib 라는 디렉토리에서 해당 name과 일치하는것들을 다 참조하라는 것이다.

이런식으로 path를 reference하게 할 수 있다.

in Ant Types mean just set of tags

classfileset is a specialized type of fileset which, given a set of "root" classes, will include all of the class files upon which the root classes depend. This is typically used to create a jar with all of the required classes for a particular application

이 태그는 라이브러리 필요하다. ANT_HOME/lib에 jar를 복붙해서 넣으면 된다.

Use '-projecthelp' in command line to display this project description.

위에서 말했듯이 그냥 root class 하나 (이경우에는 Test) 하나 했지만 알아서 모든밑에 애들을 jar 로 만들어준것을 확인 할 수 있다.

patternset는 해당 지정해준 패턴을 가지고 있는다. 이 경우에는 clean에서 refid로 참조했다.

description 태그를 사용하는 방법은 option으로 -projecthelp를 치는것이다.

공유하기 글 요소 저작자표시

from http://tonylim.tistory.com/250 by ccl(A) rewrite - 2021-09-13 12:00:53