js 代码
- <?xml version="1.0"?>
- <project name="springproj" basedir="." default="mail">
- <property name="pro.name" value="springproj" />
- <property name="pro.author" value="Danlley Wei" />
- <property name="src.dir" value="src/main/java" />
- <property name="pro.web.root" value="war" />
- <property name="pro.web.source" value="${pro.web.root}/WEB-INF" />
- <property name="pro.build.path" value="${pro.web.source}/classes" />
- <property name="user.dir" value="${pro.build.path}" />
- <target name="mail" depends="mkzip">
- <mail mailhost="smtp.126.com" mailport="25" subject="The Build Test" user="用户名" password="邮箱密码">
- <from address="发送地址" name="Danlley Wei" />
- <fileset dir="report/html">
- <include name="**/test-result${ant.project.name}.zip" />
- </fileset>
- <to address="邮件接收地址" name="Danlley Wei" />
- <message>The ${pro.name}--${pro.author} has been tested ! </message>
- </mail>
- </target>
- <target name="mkzip" depends="report">
- <jar destfile="report/html/test-result${ant.project.name}.zip">
- <fileset dir="report/html">
- <include name="**/*.html" />
- <include name="**/*.css" />
- <include name="**/*.txt" />
- </fileset>
- </jar>
- </target>
- <target name="report" depends="junit">
- <junitreport id="myJUnitReport" taskname="reported" todir="report" description="Junit Report">
- <fileset dir="report">
- <include name="TEST-*.xml" />
- </fileset>
- <report todir="report/html" />
- </junitreport>
- </target>
- <target name="junit" depends="build">
- <mkdir dir="report/html" />
- <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" fork="yes">
- <formatter type="plain" usefile="false" />
- <formatter type="xml" />
- <test name="org.danlley.hibernate.dao.DeptDAOImplTest" todir="report" />
- <classpath refid="master-classpath" />
- </junit>
- </target>
- <target name="build" depends="prepare">
- <javac destdir="${pro.build.path}" target="1.5">
- <src path="${src.dir}" />
- <classpath refid="master-classpath" />
- </javac>
- <javac destdir="${pro.build.path}" target="1.5">
- <src path="src/main/test" />
- <classpath refid="master-classpath" />
- </javac>
- </target>
- <target name="prepare" depends="clean">
- <copy todir="${pro.build.path}">
- <fileset dir="${src.dir}">
- <include name="**/*.properties" />
- <include name="**/*.xml" />
- </fileset>
- </copy>
- </target>
- <target name="clean">
- <delete>
- <fileset dir="${pro.build.path}">
- <include name="**/*.*" />
- </fileset>
- <fileset dir="report">
- <include name="**/*.*" />
- </fileset>
- </delete>
- </target>
- <path id="master-classpath">
- <fileset dir="lib">
- <include name="*.jar" />
- </fileset>
- <pathelement path="${pro.build.path}" />
- </path>
- </project>
target依赖关系:
mail→mkzip→report→junit→build→prepare→clean
工程classpath:master-classpath
clean节点: 删除测试和编译过程中生成的所有文件 prepare节点: 将工程编译打包所需资源文件全部拷贝到编译路径下 build节点: 生成工程源文件和测试代码源文件的二进制版本 junit节点: 运行测试用例 report节点: 生成测试报告 mkzip节点: 将生成的测试报告以zip格式进行打包 mail节点: 将测试结果发送到开发小组邮箱
1. 我在模板 中使用的126邮箱,如果你的邮箱是新申请的126邮箱,上述模板可能没办法发送你的邮件,原因是126邮箱对于新申请的用户暂时不开通smtp和pop3服务 2.ant并不会自带安装发送邮件所需相关资源包,因此需要我们手动到sun官方网站下载,然后把资源包放到ant的lib下面,我的位置是:D:\apache-ant-1.7.0\lib 可以从下面地址下载ant发邮件所需的两个资源(mail.jar和activation.jar): http://java.sun.com/products/javamail http://java.sun.com/products/javabeans/glasgow/jaf.html
相关推荐
使用Ant编译打包
使用Ant构建web项目 从编译到测试 生成测试报告 打包 邮件发送 远程下载tomcat 部署运行一条龙服务之ant脚本
Jmeter+ant自动生成测试报告的模板,测试报告中增加TPS(Throughput)和90% Line等指标;
Ant编译打包android工程,签名,多渠道
使用ant编译打包应用程序,比较简单,适合初学者。
介绍了如何通过ant进行java web工程的编译操作的详细配置
通过ant脚本,编译打包android工程。 编译打包android工程的ant脚本,Android官方提供的打包脚本。 有注释
ant递归编译测试源码,基于import macrodef subant if available dirname
因为项目的需要必须写一个ANDROID_ANT自动编译打包签名的脚本,终于奋斗了几天写完了,和大家分享一下
ant标签说明、ant案例、ant与eclipse工具配置以及使用
一个普通java程序用ant打包的列子,完整的,里面采用的是eclipse自带的编译插件进行的打包,需要结合eclipse中的插件一起使用
当一个代码项目大了以后,每次重新编译,打包,测试等都会变得非常复杂而且重复,因此c语言中有make脚本来帮助这些工作的批量完成。在Java 中应用是平台无关性的,当然不会用平台...本文介绍了android编译和ant打包原理
直接使用flex的sdk生成swc文件,很繁琐,而且对于大项目来说,是个头痛的事情。ant在对java打包生成jar时,它优良的设计显露无疑,这里我们使用它,来生成swc,完成项目编译打包。
ANT配置,打包,编译
ant 编译、打包、部署项目的build文件
ant脚本编译出jar
此文档为ANT编译打包相关的文档,有截图,手把手教如何用
ant 编译jar包
用Eclipse IDE可以自动生成ANT的build文件,但是该文件的路径名移植性太差。当应用hudson一类的自动化平台来构建Eclipse插件时,不能直接调用ANT工具来编译。本工具自动修改Eclipse的路径为 ${ECLIPSE_HOME},并且...