<?xml version="1.0"?>
<!-- 工程名称 -->
<project name="crawlparser" default="build" basedir=".">
<!-- 初始参数 -->
<property name="build" value="E:\\crawl\\spider" />
<property name="build.src" value="src" />
<property name="build.lib" value="${build}/lib" />
<property name="build.bin" value="${build}/bin" />
<property name="build.input" value="${build}/input" />
<property name="build.output" value="${build}/output" />
<property name="build.logs" value="${build}/logs" />
<!-- 编译依赖jar -->
<path id="classpath">
<fileset dir="lib" includes="*.jar" />
</path>
<!-- 编译jar路径转换,用于manifest.mf 中的class-path -->
<pathconvert property="mf.classpath" pathsep=" " description="将path中的路径以空格分开">
<mapper>
<chainedmapper>
<!-- 移除绝对路径 -->
<flattenmapper />
<!-- 加上lib前缀 -->
<globmapper from="*" to="lib/*" />
</chainedmapper>
</mapper>
<path refid="classpath" description="path引用了上面定义的classpath" />
</pathconvert>
<!--
===================================================================
Prepare the build
===================================================================
-->
<target name="prepare">
<delete dir="${build}" verbose="true" />
<mkdir dir="${build}" />
</target>
<!--
===================================================================
Build the code
===================================================================
-->
<target name="build" depends="prepare" description="--> compiles the source code">
<mkdir dir="${build.lib}" />
<mkdir dir="${build.bin}" />
<mkdir dir="${build.input}" />
<mkdir dir="${build.output}" />
<mkdir dir="${build.logs}" />
<echo>direct create completed</echo>
<!-- 编译 -->
<javac srcdir="${build.src}" destdir="${build.bin}" includeantruntime="false" debug="true" deprecation="true" target="1.5" source="1.5" optimize="true" failοnerrοr="true">
<classpath refid="classpath" />
</javac>
<echo>source compile completed</echo>
<!-- 拷贝配置文件 -->
<copy todir="${build.bin}">
<fileset dir="${build.src}" includes="*.properties" />
<fileset dir="config" includes="*.spring.xml" />
<fileset dir="config" includes="*.sh" />
</copy>
<!-- jar包压缩 -->
<jar basedir="${build.bin}" destfile="${build}/crawlmain.jar" whenmanifestonly="fail">
<manifest>
<attribute name="Manifest-Version" value="1.0" />
<attribute name="Class-Path" value=". ${mf.classpath}" />
<attribute name="Main-Class" value="com.suning.crawler.main.CrawlMain" />
</manifest>
</jar>
<delete dir="${build.bin}" />
<echo>jar create completed</echo>
<!-- 拷贝依赖jar包 -->
<copy todir="${build.lib}">
<fileset dir="lib">
<include name="*.jar" />
</fileset>
</copy>
<echo>copy jar complete</echo>
<copy todir="${build}">
<fileset dir="." includes="*.sh" />
</copy>
<echo>copy spring config complete</echo>
</target>
</project>
<!--
===============================================
详细信息请参考 ant 官网 http://ant.apache.org/
===============================================
-->
<!-- 工程名称 -->
<project name="crawlparser" default="build" basedir=".">
<!-- 初始参数 -->
<property name="build" value="E:\\crawl\\spider" />
<property name="build.src" value="src" />
<property name="build.lib" value="${build}/lib" />
<property name="build.bin" value="${build}/bin" />
<property name="build.input" value="${build}/input" />
<property name="build.output" value="${build}/output" />
<property name="build.logs" value="${build}/logs" />
<!-- 编译依赖jar -->
<path id="classpath">
<fileset dir="lib" includes="*.jar" />
</path>
<!-- 编译jar路径转换,用于manifest.mf 中的class-path -->
<pathconvert property="mf.classpath" pathsep=" " description="将path中的路径以空格分开">
<mapper>
<chainedmapper>
<!-- 移除绝对路径 -->
<flattenmapper />
<!-- 加上lib前缀 -->
<globmapper from="*" to="lib/*" />
</chainedmapper>
</mapper>
<path refid="classpath" description="path引用了上面定义的classpath" />
</pathconvert>
<!--
===================================================================
Prepare the build
===================================================================
-->
<target name="prepare">
<delete dir="${build}" verbose="true" />
<mkdir dir="${build}" />
</target>
<!--
===================================================================
Build the code
===================================================================
-->
<target name="build" depends="prepare" description="--> compiles the source code">
<mkdir dir="${build.lib}" />
<mkdir dir="${build.bin}" />
<mkdir dir="${build.input}" />
<mkdir dir="${build.output}" />
<mkdir dir="${build.logs}" />
<echo>direct create completed</echo>
<!-- 编译 -->
<javac srcdir="${build.src}" destdir="${build.bin}" includeantruntime="false" debug="true" deprecation="true" target="1.5" source="1.5" optimize="true" failοnerrοr="true">
<classpath refid="classpath" />
</javac>
<echo>source compile completed</echo>
<!-- 拷贝配置文件 -->
<copy todir="${build.bin}">
<fileset dir="${build.src}" includes="*.properties" />
<fileset dir="config" includes="*.spring.xml" />
<fileset dir="config" includes="*.sh" />
</copy>
<!-- jar包压缩 -->
<jar basedir="${build.bin}" destfile="${build}/crawlmain.jar" whenmanifestonly="fail">
<manifest>
<attribute name="Manifest-Version" value="1.0" />
<attribute name="Class-Path" value=". ${mf.classpath}" />
<attribute name="Main-Class" value="com.suning.crawler.main.CrawlMain" />
</manifest>
</jar>
<delete dir="${build.bin}" />
<echo>jar create completed</echo>
<!-- 拷贝依赖jar包 -->
<copy todir="${build.lib}">
<fileset dir="lib">
<include name="*.jar" />
</fileset>
</copy>
<echo>copy jar complete</echo>
<copy todir="${build}">
<fileset dir="." includes="*.sh" />
</copy>
<echo>copy spring config complete</echo>
</target>
</project>
<!--
===============================================
详细信息请参考 ant 官网 http://ant.apache.org/
===============================================
-->