'ANT'에 해당되는 글 1건
- 2009.05.06 :: [Ant] 설치 및 따라해보기
ANT
2009. 5. 6. 11:43
설명을 안써서...
매뉴얼에 나와있지만 써본다.
Apache Ant is a Java-based build tool. In theory, it is kind of like make, without make's wrinkles.
매뉴얼에 나와있지만 써본다.
Apache Ant is a Java-based build tool. In theory, it is kind of like make, without make's wrinkles.
사실 설치하는 것을 설명할 필요는 없다.
http://ant.apache.org/manual/index.html
매뉴얼이 친절하게 알려준다.
여기서 중요한 점은 환경변수 설정인데
- Add the bin
directory to your path.
- Set the ANT_HOME
environment variable to the directory where you installed Ant. On some operating systems, Ant's startup scripts can guess ANT_HOME
(Unix dialects and Windows NT/2000), but it is better to not rely on this behavior.
라고 나와있다.
PATH에 빈디렉터리를 추가해주고 ANT_HOME을 만들어서 ANT의
경로를 추가해주면 된다.
도스창에 들어가서 ant를 치면 메시지가 띡-하고 뜬다. 그 다음에 버전을 체크하면 버전표시가 띡-하고 뜬다.
그 다음 중요한 점은 buildfile 작성하기.
ant의 빌드파일은 xml로 되어있다.
빌드파일의 예제
<project name="MyProject" default="dist" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
http://pcguy7.springnote.com/pages/546569
다음에 올라온 예제를 실행해본 결과,
Buildfile: E:\project\ztest\WebContent\build.xml
prepare:
[echo] Build Start!! ======> 2009.03.04-10:41
clean:
[delete] Deleting directory E:\project\ztest\WebContent\dist
compile:
[mkdir] Created dir: E:\project\ztest\WebContent\build
mkjar:
[mkdir] Created dir: E:\project\ztest\WebContent\dist
[jar] Warning: skipping jar archive E:\project\ztest\WebContent\dist\1.0_helloprint.jar because no files were included.
[jar] Building MANIFEST-only jar: E:\project\ztest\WebContent\dist\1.0_helloprint.jar
dist:
[copy] Copied 1 empty directory to 1 empty directory under E:\project\ztest\WebContent\dist\lib
[copy] Copied 1 empty directory to 1 empty directory under E:\project\ztest\WebContent\dist\src
[zip] Building zip: E:\project\ztest\WebContent\2009.03.04_1.0_helloprint.zip
BUILD SUCCESSFUL
Total time: 203 milliseconds
경고만 빼면...그럭저럭 돌아가는 듯하다.prepare:
[echo] Build Start!! ======> 2009.03.04-10:41
clean:
[delete] Deleting directory E:\project\ztest\WebContent\dist
compile:
[mkdir] Created dir: E:\project\ztest\WebContent\build
mkjar:
[mkdir] Created dir: E:\project\ztest\WebContent\dist
[jar] Warning: skipping jar archive E:\project\ztest\WebContent\dist\1.0_helloprint.jar because no files were included.
[jar] Building MANIFEST-only jar: E:\project\ztest\WebContent\dist\1.0_helloprint.jar
dist:
[copy] Copied 1 empty directory to 1 empty directory under E:\project\ztest\WebContent\dist\lib
[copy] Copied 1 empty directory to 1 empty directory under E:\project\ztest\WebContent\dist\src
[zip] Building zip: E:\project\ztest\WebContent\2009.03.04_1.0_helloprint.zip
BUILD SUCCESSFUL
Total time: 203 milliseconds