른록노트

[ant] 외부 라이브러리 이용하여 build 하는 방법 본문

Server,OS/[Linux]

[ant] 외부 라이브러리 이용하여 build 하는 방법

른록 2020. 6. 12. 19:31

@ 방법

<?xml version="1.0"?>
<project name="AntTest" default="main" basedir=".">
    <property name="name" value="dist"></property>
    <property name="project.version" value="1.0.0"></property>

    <property name="src.dir" value="src"></property>
    <property name="build.dir" value="build"></property>
    <property name="classes.dir" value="${build.dir}/classes"></property>
    <property name="jar.dir" value="${build.dir}/jar"></property>
    <property name="lib.dir" value="lib"></property>

    <path id="classpath">
        <fileset dir="${lib.dir}" includes="**/*.jar"></fileset>
    </path>

    <target name="clean">
        <delete dir="${build.dir}"></delete>
    </target>
    <target name="init">
        <mkdir dir="${build.dir}"></mkdir>
        <mkdir dir="${build.dir}/classes"></mkdir>
    </target>
    <target name="compile" depends="init">
        <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" includeantruntime="false">
        </javac>
    </target>
    <target name="jar" depends="compile">
        <jar destfile="${build.dir}/${name}-${project.version}.jar" basedir="${build.dir}/classes">
        </jar>
    </target>
  
    <target name="main" depends="clean,jar">
    </target>
</project>

 

@실행방법

 build.xml이 있는곳으로 경로를 이동하여

 ant main 명령어 실행

 

 

@ 참고사이트

https://kamang-it.tistory.com/entry/Ant%EC%99%B8%EB%B6%80-%EB%9D%BC%EC%9D%B4%EB%B8%8C%EB%9F%AC%EB%A6%ACjar%EB%A5%BC-%EC%82%AC%EC%9A%A9%ED%95%B4%EC%84%9C-%EB%B9%8C%EB%93%9C-%ED%95%98%EA%B8%B08

 

반응형
Comments