ant 使用笔记
2012-08-01 15:47
246 查看
一、常见的ant自带task
1.echo 显示在console或者是file中
<echo message="hello">
<echo message="Good morning!" file="log.txt" append="true">
2.mkdir 创建文件
<mkdir dir="${dist}/lib">
3.copy 拷贝文件(执行copy条件,源文件新于目标文件or目标文件不存在)
<copy todir="${dist}/conf" overwrite="true">
<fileset dir="${src}/WEB-INF">
<include name="*.xml">
</fileset>
<copy>
4.自动打jar包和zip源码包
<target name="adbrandFacadeJarZip" depends="compile, pages" description="package adBrandFacade into jar and zip files">
<jar jarfile="${dist.dir}/${ead_name}.jar" compress="true" basedir="${build.dir}">
<include name="**/IAdBrandDao.class" />
<include name="**/AdBrandDaoImpl.class" />
</jar>
<zip destfile="${dist.dir}/${ead_name}-src.zip">
<fileset dir="${src.dir}">
<include name="**/IAdBrandDao.java" />
<include name="**/AdBrandDaoImpl.java" />
</fileset>
</zip>
</target>
5.scp 远程拷贝
<scp todir="user:password@somehost:/home/">
<fileset dir="src_dir">
<include name="**/*.java"/>
</fileset>
</scp>
二、target下的task自定义
1.java文件(jar)
public class HelloWorld {
String msg;
public void execute() {
System.out.println(msg);
}
public void setMsg(String msg) {
this.msg = msg;
}
}
2.build.xml配置
<target description="Use the Task">
<taskdef name="helloworld" classname="HelloWorld" classpath="helloworld.jar"/>
<helloworld msg="Hello World"/>
</target>
1.echo 显示在console或者是file中
<echo message="hello">
<echo message="Good morning!" file="log.txt" append="true">
2.mkdir 创建文件
<mkdir dir="${dist}/lib">
3.copy 拷贝文件(执行copy条件,源文件新于目标文件or目标文件不存在)
<copy todir="${dist}/conf" overwrite="true">
<fileset dir="${src}/WEB-INF">
<include name="*.xml">
</fileset>
<copy>
4.自动打jar包和zip源码包
<target name="adbrandFacadeJarZip" depends="compile, pages" description="package adBrandFacade into jar and zip files">
<jar jarfile="${dist.dir}/${ead_name}.jar" compress="true" basedir="${build.dir}">
<include name="**/IAdBrandDao.class" />
<include name="**/AdBrandDaoImpl.class" />
</jar>
<zip destfile="${dist.dir}/${ead_name}-src.zip">
<fileset dir="${src.dir}">
<include name="**/IAdBrandDao.java" />
<include name="**/AdBrandDaoImpl.java" />
</fileset>
</zip>
</target>
5.scp 远程拷贝
<scp todir="user:password@somehost:/home/">
<fileset dir="src_dir">
<include name="**/*.java"/>
</fileset>
</scp>
二、target下的task自定义
1.java文件(jar)
public class HelloWorld {
String msg;
public void execute() {
System.out.println(msg);
}
public void setMsg(String msg) {
this.msg = msg;
}
}
2.build.xml配置
<target description="Use the Task">
<taskdef name="helloworld" classname="HelloWorld" classpath="helloworld.jar"/>
<helloworld msg="Hello World"/>
</target>
相关文章推荐
- 【学习笔记】系列十四:Ant安装与使用举例
- Android笔记之:App自动化之使用Ant编译项目多渠道打包的使用详解
- Ant学习笔记(2) 在Eclipse中使用Ant
- ant使用笔记(1):安装
- 自动构建工具Ant的使用-笔记
- 大数据学习笔记:在eclipse上使用Ant插件实现自动编译打包
- ANT使用笔记
- 01- 使用brew 安装ant -学习笔记(一)
- 自动构建工具Ant的使用-笔记
- 自动构建工具Ant的使用-笔记
- Android笔记之:App自动化之使用Ant编译项目多渠道打包的使用详解
- ant笔记(二)ant的属性使用与引用外部变量,集成一个编译,拷贝,打包,运行的任务链
- Ant笔记(二)Ant使用
- ant使用笔记
- 自动构建工具Ant的使用-笔记
- ant笔记(一)初步使用:搭建环境和运行测试例子
- ant使用笔记
- Android笔记之:App自动化之使用Ant编译项目多渠道打包的使用详解
- ant使用笔记