ant常用操作(编译)
一、编译1.Compile_unix.xml<project name="project" default="compile"><target name="init"> <!-- mdxbu.properties中定义的是一些键值对,例如BUILD_FILE_PATH=/opt/temp --><property file="mdxbu.properties"></property><property name="build_file_path" location="${BUILD_FILE_PATH}"></property><property name="jar_package_path" location="${VERSION_INSTALL_PATH}"></property><property name="configuration_path" value="${VERSION_CONFIGURATION_PATH}/mdxbu.properties"/><delete dir="${jar_package_path}"></delete><mkdir dir="${jar_package_path}"/> </target><target name="compile" depends="init" description="--> call each module buildfile"> <ant antfile="${build_file_path}/Hibernate.xml" inheritAll="true"/></target></project>2.Hibernate.xml实例<project basedir="." default="build" name="Hibernate"> <property environment="env"/> <property name="debuglevel" value="source,lines,vars"/> <property name="target" value="1.5"/> <property name="source" value="1.5"/> <property name="java_home" value="${JAVA_HOME_PATH}"/> <property name="Hibernate_home_path" value="${SOURCE_HOME_PATH}/MediaX-Hibernate"/> <property name="Hibernate_src" value="${Hibernate_home_path}/src"/> <property name="Hibernate_lib" value="${Hibernate_home_path}/lib"/> <property name="Hibernate_bin" value="${Hibernate_home_path}/bin"/> <property name="Hibernate_jar" value="com.huawei.mediax.hibernate_${HIBERNATE_VERSION}.jar"/> <path id="Plug-in Dependencies.libraryclasspath"/> <path id="Hibernate.classpath"> <pathelement location="${Hibernate_lib}/commons-lang.jar"/> <path refid="Plug-in Dependencies.libraryclasspath"/> </path> <target name="init" depends="cleanall"> <mkdir dir="${Hibernate_bin}"/> <copy includeemptydirs="false" todir="${Hibernate_bin}"> <fileset dir="${Hibernate_src}" excludes="**/*.launch, **/*.java"/> </copy> </target> <target name="clean"> <delete dir="${Hibernate_bin}"/> </target> <target depends="clean" name="cleanall"/> <target depends="deploy_hibernate" name="build"/> <target depends="init" name="build-project"> <echo message="${ant.project.name}: ${ant.file}"/> <javac debug="true" debuglevel="${debuglevel}" destdir="${Hibernate_bin}" source="${source}" target="${target}" fork="yes" executable="${java_home}/bin/javac"> <src path="${Hibernate_src}"/> <classpath refid="Hibernate.classpath"/> </javac> </target><target depends="build-project" name="deploy_hibernate"> <!-- deploy time stamp --> <tstamp> <format property="deploy.time" pattern="dd-MMMM-yyyy hh:mm:ss a" locale="en,CN" /> </tstamp><!-- filesetmanifest="merge" --><jar jarfile="${VERSION_INSTALL_PATH}/${Hibernate_jar}" compress="on" filesetmanifest="mergewithoutmain"><fileset dir="${Hibernate_home_path}"><include name="lib/**/**" /><include name="OSGI-INF/**/**"/><include name="META-INF/**/**" /></fileset> <fileset dir="${Hibernate_bin}"><include name="**/**" /></fileset><manifest> <attribute name="Build-By" value="${user.name}" /> <attribute name="Create-Time" value="${deploy.time}" /></manifest></jar></target> </project>