ant完整示例
程序员文章站
2022-04-06 11:04:59
...
<?xml version="1.0" encoding="UTF-8"?> <project name="cloud-ssh2"> <property file="ant.properties"></property> <property name="src.dir" location="src"></property> <property name="test.dir" location="test"></property> <property name="target.dir" location="target"></property> <property name="target.classes" location="${target.dir}/classes"></property> <property name="target.test" location="${target.dir}/test"></property> <property name="test.output" location="${target.dir}/output"></property> <property name="test.output.html" location="${target.dir}/html"></property> <property name="web.dir" location="WebContent"></property> <path id="classpath"> <fileset dir="D:/Java/dev/eclipse-jee-maven/apache-tomcat-7.0.52/lib"> <include name="*.jar" /> </fileset> <fileset dir="WebContent/WEB-INF/lib"> <include name="*.jar" /> </fileset> </path> <path id="classpath-test"> <path refid="classpath"></path> <pathelement location="${target.classes}"/> </path> <path id="classpath-test-run"> <path refid="classpath-test"></path> <pathelement location="${target.test}"/> </path> <fileset id="test-class" dir="${target.test}"> <include name="**/*.class"/> </fileset> <target name="show"> <echo>${datasource.mysql.username}</echo> <echo>${datasource.mysql.password}</echo> <echo>${datasource.mysql.databaseUrl}</echo> <echo>${datasource.mysql.databaseDriver}</echo> <echo>----------------------------------</echo> <echo>${ant.project.name}</echo> <echo>${ant.version}</echo> <echo>${ant.file}</echo> <echo>${basedir}</echo> <echo>${ant.java.version}</echo> <echo>${ant.core.lib}</echo> </target> <target name="clean" depends="show"> <echo>Began to clean up</echo> <delete dir="${target.dir}"></delete> </target> <target name="init" depends="clean"> <echo>Began to mkdir</echo> <mkdir dir="${target.dir}"/> <mkdir dir="${target.classes}"/> <mkdir dir="${target.test}"/> <mkdir dir="${test.output}"/> <mkdir dir="${test.output.html}"/> </target> <target name="compile" depends="init"> <echo>Began to compile java src</echo> <javac includeantruntime="true" destdir="${target.classes}" srcdir="${src.dir}" classpathref="classpath" /> <echo>Copy resource file to dest dir</echo> <copy todir="${target.classes}"> <fileset dir="${src.dir}"> <exclude name="**/*.java"/> </fileset> </copy> <echo>Began to compile test src</echo> <javac includeantruntime="true" destdir="${target.test}" srcdir="${test.dir}" classpathref="classpath-test" /> </target> <target name="test" depends="compile"> <echo>Run junit test</echo> <junit printsummary="true"> <classpath refid="classpath-test-run"></classpath> <formatter type="xml"/> <batchtest todir="${test.output}"> <fileset refid="test-class"></fileset> </batchtest> </junit> <junitreport> <fileset dir="${test.output}"> <include name="*.xml"/> </fileset> <report format="frames" todir="${test.output.html}"/> </junitreport> </target> <target name="war" depends="compile"> <war destfile="${target.dir}/${ant.project.name}.war" webxml="${web.dir}/WEB-INF/web.xml"> <fileset dir="${web.dir}" excludes="**/*.jar"></fileset> <lib dir="${web.dir}/WEB-INF/lib" ></lib> <classes dir="${target.classes}"></classes> </war> </target> </project>
推荐阅读
-
甘肃十大最低分、最容易考上的大学有哪些?附甘肃野鸡大专完整名单
-
php为什么需要异步编程?php异步编程的详解(附示例)
-
示例React-router 路由切换动画的实现
-
详解Nginx中的geo模块与利用其配置负载均衡的示例
-
jQuery插件HighCharts绘制2D饼图效果示例【附demo源码下载】
-
jQuery插件HighCharts绘制简单2D折线图效果示例【附demo源码】
-
jQuery插件HighCharts绘制简单2D柱状图效果示例【附demo源码】
-
shell写的告警次数控制及恢复示例代码
-
mysql触发器之触发器的增删改查操作示例
-
ASP.NET Core MVC 中实现中英文切换的示例代码