Simple Ant build.xml file
2013-04-21 10:18
357 查看
<?xml version="1.0" encoding="UTF-8"?> <project name="junitDemo02" default="test" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant"> <property name="src.dir" location="src"/> <property name="src.java.dir" location="${src.dir}/java"/> <property name="src.test.dir" location="${src.dir}/test"/> <property name="build.dir" location="build"/> <property name="classes.java.dir" location="${build.dir}/classes/java"/> <property name="classes.test.dir" location="${build.dir}/classes/test"/> <property name="lib.dir" location="lib"/> <property name="test.report.dir" location="${build.dir}/report"/> <path id="classpath.java.compile"> <fileset dir="${lib.dir}"> <include name="**/*.jar"/> </fileset> </path> <!-- classpath for compiling test source files--> <path id="classpath.test.compile"> <path refid="classpath.java.compile"/> <pathelement location="${classes.java.dir}"/> </path> <!-- classpath for running tests --> <path id="classpath.test.run"> <path refid="classpath.test.compile"/> <pathelement location="${classes.test.dir}"/> </path> <target name="init" description="--> Init the directories"> <mkdir dir="${src.dir}"/> <mkdir dir="${src.java.dir}"/> <mkdir dir="${src.test.dir}"/> <mkdir dir="${lib.dir}"/> </target> <target name="resolve" description="--> resolve all the dependencies by ivy" depends="init"> <ivy:retrieve/> </target> <target name="clean" description="--> clean the build directory"> <delete dir="${build.dir}"/> </target> <target name="compile.java" description="--> compile all the main java files"> <mkdir dir="${classes.java.dir}"/> <javac destdir="${classes.java.dir}" srcdir="${src.java.dir}" includeAntRuntime="yes"/> </target> <target name="compile.test" description="--> compile all the tests source files"> <mkdir dir="${classes.test.dir}"/> <javac destdir="${classes.test.dir}" srcdir="${src.test.dir}" classpathref="classpath.test.compile" includeAntRuntime="yes"/> </target> <target name="compile" description="--> compile both main and test source files" depends="clean, compile.java, compile.test"/> <target name="test" depends="compile"> <mkdir dir="${test.report.dir}"/> <junit printsummary="yes" fork="yes"> <formatter type="xml"/> <batchtest todir="${test.report.dir}"> <fileset dir="${src.test.dir}"> <include name="**/*Test.java"/> </fileset> </batchtest> <classpath refid="classpath.test.run"/> </junit> </target> <target name="report" depends="test" description="--> create the test result report"> <mkdir dir="${test.report.dir}/html"/> <junitreport todir="${test.report.dir}"> <fileset dir="${test.report.dir}"> <include name="TEST-*.xml"/> </fileset> <report todir="${test.report.dir}/html"/> </junitreport> </target> </project>
相关文章推荐
- Simple usage of ant build file build.xml
- ant打包:Build error referencing build.xml and proguard file: “null returned: 1”
- Ant build.xml 构建文件 打包发布
- ant build.xml 之 tomcat工程的通用模板
- Ant build.xml 模板
- Java Ant build.xml详解
- ANT-build.xml文件详解(转载)
- ant-build.xml文件详解(转)
- eclipse中发布andriod应用时出现Error in an XML file: aborting build解决
- 2.扩展ant,对文件内容的行进行排序:build.xml
- 自己写的一个ant使用build.xml
- Android项目使用Ant打包,自动生成build.xml
- ant的安装以及build.xml文档的编写
- ANT 发布项目中 build.xml 文件的详细配置
- ant创建 发布 EJB build.xml 文件的编写
- JAVA Ant 之 build.xml 标签详解
- Ant build.xml中的各种变量
- Ant 自动构建 build.xml
- ant build.xml study
- 【Ant】How to print all the system properties in Ant build file