1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | <?xml version="1.0" encoding="utf-8"?> <project default="main" basedir="."> <!-- ==================================================================== properties: build.xml에서 사용하는 속성값을 설정한다. ==================================================================== --> <property name="name" value="vegeta" /> <property name="version" value="1.0" /> <property name="src.dir" value="src" /> <property name="build.dir" value="build" /> <property name="classes.dir" value="${build.dir}/classes" /> <property name="jar.file" value="${build.dir}/${name}.jar" /> <property name="dist.dir" value="dist" /> <property name="dist.file" value="${dist.dir}/${name}-${version}" /> <property name="lib.dir" location="libs"/> <!-- Runnable jar 만들기 위한 main클래스 배포용으로 만들땐 이 부분만 빼주면 된다.--> <property name="main-class" value="mrsohn.gui.MainLayout"/><path id="classpath"> <fileset dir="${lib.dir}" includes="*.jar"/> </path> <!-- ==================================================================== compile 타겟 : java파일을 컴파일한다. ==================================================================== --> <!-- <target name="compile"><mkdir dir="${build.dir}" /> <mkdir dir="${classes.dir}" /> <javac srcdir="${src.dir}" destdir="${classes.dir}" encoding="utf-8" includeantruntime="false"> </javac> </target> --> <target name="compile"> <mkdir dir="${classes.dir}" /> <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="yes"includeantruntime="false"> <classpath refid="classpath" /> </javac> </target> <!-- ==================================================================== jars 타겟 : 컴파일한 클래스 파일을 jar로 묶는다. ==================================================================== --> <target name="jars" depends="compile"><jar jarfile="${jar.file}" basedir="${classes.dir}"> <manifest> <attribute name="Main-Class" value="${main-class}" / > <attribute name="Class-Path" value="${jar.dir}/${lib.dir}/vegeta.jar" /> </manifest> </jar> </target> <!-- ==================================================================== distribution 타겟 : 배포본을 만든다. ==================================================================== --> <target name="dist" depends="jars"> <mkdir dir="${dist.file}" /> <zip destfile="${dist.file}.zip" basedir="${build.dir}" includes="*.jar" /> </target> <!-- ============================================================================== main 타겟 : 사용자가 타겟을 지정하지 않은 경우, 기본 값으로 지정되는 타겟이다. ============================================================================== --> <target name="main" depends="jars" /> <!-- ============================================================================== clean 타겟 : 이전의 컴파일한 클래스 파일과 배포 본을 지운다. ============================================================================== --> <target name="clean"> <delete dir="${build.dir}" /> <delete dir="${dist.dir}" /> </target> <!-- ============================================================================== all 타겟 : 모든 작업을 수행한다. ============================================================================== --> <target name="all" depends="clean, dist" /> </project> | cs |