이제야 좀 쓸만하네..;
약간 더 공을 들여서 일일이 복사할 라이브러리를 지정해주면 정확하게 동작한다.
나머지 프로젝트의 경우 바로 아래의 build.xml 정도만 기술해주면 된다.
공통으로 common.xml 쓰고 세세한 프로젝트별 설정만 해주면 되는 것임.
cve 수집기 build.xml
<project name="cvecollector" default="bin" basedir=".">
<import file="../../common.xml" />
<property name="main-class" value="kr.nchovy.collector.cve.CveCollector" />
<target name="compile-dependent-projects">
<subant failonerror="true" buildpath="../../model/cve" />
<copy file="../../model/cve/bin/model-cve.jar" todir="${bin}" />
</target>
<target name="copy-dependent-libraries">
<copy todir="${bin}">
<fileset dir="../../../vendor/">
<include name="*.jar" />
</fileset>
</copy>
</target>
<target name="copy-resources">
<copy file="hibernate.cfg.xml" todir="${obj}" />
<copy file="log4j.properties" todir="${obj}" />
</target>
</project>
CVE 모델 build.xml
<project name="model-cve" default="bin" basedir=".">
<import file="../../common.xml" />
<property name="main-class" value="" />
<target name="compile-dependent-projects" />
<target name="copy-dependent-libraries">
</target>
<target name="copy-resources">
<copy todir="${obj}/kr/nchovy/model/cve">
<fileset dir=".">
<include name="*.hbm.xml" />
</fileset>
</copy>
</target>
</project>
common.xml
<project>
<property name="obj" location="obj" />
<property name="bin" location="bin" />
<path id="libraries">
<fileset dir="${bin}">
<include name="*.jar" />
</fileset>
</path>
<target name="clean">
<delete dir="${obj}" />
<delete dir="${bin}" />
</target>
<target name="init">
<tstamp/>
<mkdir dir="${obj}" />
<mkdir dir="${bin}" />
</target>
<target name="compile" depends="init, copy-dependent-libraries, compile-dependent-projects">
<javac srcdir="." destdir="${obj}" classpathref="libraries" />
</target>
<target name="bin" depends="compile, copy-resources">
<fileset id="jars" dir="${bin}">
<include name="*.jar" />
</fileset>
<path id="cp">
<fileset refid="jars" />
</path>
<pathconvert property="classpath" refid="cp" pathsep=" " dirsep="/">
<map from="${bin}/" to="" />
</pathconvert>
<jar jarfile="${bin}/${ant.project.name}.jar" basedir="${obj}">
<manifest>
<attribute name="Main-Class" value="${main-class}" />
<attribute name="Class-Path" value="${classpath}" />
</manifest>
</jar>
</target>
</project>
약간 더 공을 들여서 일일이 복사할 라이브러리를 지정해주면 정확하게 동작한다.
나머지 프로젝트의 경우 바로 아래의 build.xml 정도만 기술해주면 된다.
공통으로 common.xml 쓰고 세세한 프로젝트별 설정만 해주면 되는 것임.
cve 수집기 build.xml
<project name="cvecollector" default="bin" basedir=".">
<import file="../../common.xml" />
<property name="main-class" value="kr.nchovy.collector.cve.CveCollector" />
<target name="compile-dependent-projects">
<subant failonerror="true" buildpath="../../model/cve" />
<copy file="../../model/cve/bin/model-cve.jar" todir="${bin}" />
</target>
<target name="copy-dependent-libraries">
<copy todir="${bin}">
<fileset dir="../../../vendor/">
<include name="*.jar" />
</fileset>
</copy>
</target>
<target name="copy-resources">
<copy file="hibernate.cfg.xml" todir="${obj}" />
<copy file="log4j.properties" todir="${obj}" />
</target>
</project>
CVE 모델 build.xml
<project name="model-cve" default="bin" basedir=".">
<import file="../../common.xml" />
<property name="main-class" value="" />
<target name="compile-dependent-projects" />
<target name="copy-dependent-libraries">
</target>
<target name="copy-resources">
<copy todir="${obj}/kr/nchovy/model/cve">
<fileset dir=".">
<include name="*.hbm.xml" />
</fileset>
</copy>
</target>
</project>
common.xml
<project>
<property name="obj" location="obj" />
<property name="bin" location="bin" />
<path id="libraries">
<fileset dir="${bin}">
<include name="*.jar" />
</fileset>
</path>
<target name="clean">
<delete dir="${obj}" />
<delete dir="${bin}" />
</target>
<target name="init">
<tstamp/>
<mkdir dir="${obj}" />
<mkdir dir="${bin}" />
</target>
<target name="compile" depends="init, copy-dependent-libraries, compile-dependent-projects">
<javac srcdir="." destdir="${obj}" classpathref="libraries" />
</target>
<target name="bin" depends="compile, copy-resources">
<fileset id="jars" dir="${bin}">
<include name="*.jar" />
</fileset>
<path id="cp">
<fileset refid="jars" />
</path>
<pathconvert property="classpath" refid="cp" pathsep=" " dirsep="/">
<map from="${bin}/" to="" />
</pathconvert>
<jar jarfile="${bin}/${ant.project.name}.jar" basedir="${obj}">
<manifest>
<attribute name="Main-Class" value="${main-class}" />
<attribute name="Class-Path" value="${classpath}" />
</manifest>
</jar>
</target>
</project>




덧글