java: ant 脚本示例
<?xml version="1.0" encoding="UTF-8"?> <!--basedir是从build.xml所在的目录为基础算起的-->
<project name="acm-rest-service" default="copy" basedir="../../../"> <!--定义常用目录属性-->
<property name="encoding" value="UTF-8" />
<property name="deploy.name" value="acm-rest-service" />
<property name="src.dir" value="${basedir}/SourceCode/JavaSource/mulms/cn/com/infosky/mulms/service/rest" />
<property name="lib.dir" value="${basedir}/SourceCode/JavaSource/lib" />
<property name="config.dir" value="${basedir}/Config/mulms/rest" />
<property name="target.dir" value="C:/deploy/mulms/${deploy.name}" />
<property name="output.web-inf.dir" value="${target.dir}/WEB-INF"/>
<property name="classes.dir" value="${output.web-inf.dir}/classes" />
<property name="output.lib.dir" value="${output.web-inf.dir}/lib" /> <!--编译时的classpath-->
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</path> <!--初始化,创建主要输出目录-->
<target name="init">
<mkdir dir="${target.dir}" />
<mkdir dir="${classes.dir}" />
<mkdir dir="${output.lib.dir}" />
</target> <!--清空输出内容-->
<target name="clean">
<delete includeEmptyDirs="true" dir="${target.dir}" />
</target> <!-- 编译 -->
<target name="compile" depends="init">
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" encoding="${encoding}" includeantruntime="false">
<classpath refid="classpath" />
</javac>
</target> <!--复制相应的文件-->
<target name="copy" depends="clean,compile"> <!--将所有依赖的jar文件复制到web-inf/lib目录下-->
<copy todir="${output.lib.dir}" overwrite="yes" flatten="true">
<fileset dir="${lib.dir}/jsr-rs">
<include name="**/*.jar" />
</fileset>
</copy> <!--将web.xml复制到web-inf下-->
<copy todir="${output.web-inf.dir}" overwrite="yes" flatten="true">
<fileset dir="${config.dir}">
<include name="**/*.xml" />
</fileset>
</copy>
</target> <!--生成war包-->
<target name="webwar" depends="copy">
<war webxml="${output.web-inf.dir}/web.xml" destfile="${target.dir}/../${deploy.name}.war">
<fileset dir="${target.dir}/">
<include name="**/*.*" />
</fileset>
</war>
</target>
</project>
java: ant 脚本示例的更多相关文章
- 转: Ant 脚本的结构化设计
引言 Ant 脚本是由 Apache 提供的一种基于 Java 的构建工具,为 Java 开发人员所熟悉.Java 开发人员使用 Ant 脚本可以很方便地完成 Java 开发过程中常见的如拷贝文件.创 ...
- 利用ant脚本 自动构建svn增量/全量 系统程序升级包
首先请允许我这样说,作为开发或测试,你一定要具备这种 本领.你可以手动打包.部署你的工程,但这不是最好的方法.最好的方式就是全自动化的方式.开发人员提交了代码后,可以自动构建.打包.部署到测试环境. ...
- [自动运维]ant脚本打包,上传文件到指定服务器,并部署
1.根节点使用,表示根目录为当前目录,默认启动的target为build,项目名称为othersysm, <project basedir="." default=" ...
- 利用Ant脚本生成war包的详细步骤
使用ant脚本前的准备 1.下载一个ant安装包.如:apache-ant-1.8.4-bin.zip.解压到E盘. 2.配置环境变量.新增ANT_HOME:E:\apache-ant-1.8.4:P ...
- ant脚本编写
使用ant脚本前的准备 1.下载一个ant安装包.如:apache-ant-1.8.4-bin.zip.解压到E盘. 2.配置环境变量.新增ANT_HOME:E:\apache-ant-1.8.4:P ...
- Ant 脚本打印系统属性变量、ant内置属性
Ant 脚本打印系统属性变量.ant内置属性 作用 编写ant脚本的时候,经常会引用到系统属性,本脚本用于打印系统常用属性(System.getProperties)与环境变量(Environment ...
- [置顶] java ant 配置及构建项目
Ant是一种基于Java的构建工具.Ant文件是配置构建目标过程的XML文件,也称为Ant脚本. (因为对这个不是很了解,所以用词方面可能于个人的理解有偏差 ...
- 通过ant脚本编译打包android工程
通过ant脚本,编译打包android工程 1.Android程序编译.打包.签名.发布的三种方式: 方式一:命令行手动编译打包 方式二:使用ant自动编译打包 方式三:使用eclipse+AD ...
- 运行ant脚本(转载)
http://blog.csdn.net/linwei_1029/article/details/5809801 运行ANT脚本的步骤 1.右击我的电脑-->属性-->高级-->环境 ...
随机推荐
- PNote桌面贴小工具 - 项目管理系列文章
项目经理在项目过程中将会使用到各种工具,以期能够相互配合,对项目组的各种管理工作进行工作的开展和完成.以前就写过一些项目工具的使用,见下链接: 1.Mindjet MindManager思维导图工具的 ...
- JavaScript Patterns 5.2 Declaring Dependencies
It’s a good idea to declare the modules your code relies on at the top of your function or module. T ...
- maven-shade-plugin
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> ...
- 遍历map的常用方法
Map< String, String> map = new HashMap<String, String>(); map.put("a", " ...
- java编写冒泡排序
int[] arry={7,1,6,5,3,4,9,8,2}; for(int a=0;a<arry.length;a++) { for(int b=a+1;b<arry.length;b ...
- iOS解决隐藏导航栏后,打开照片选择器后导航栏不显示的问题以及更换导航栏背景色
问题描述: 遇到一种情况,在一个控制器上(隐藏了导航栏),打开照片选择器 UIImagePickerController后,照片选择器头部一片空白,且上滑相册时,信息会有错乱效果. 原因分析: 通过查 ...
- linux cpu占有率居高不下 调试
今天调试程序,使用top命令后,发现程序的cpu占有率很高,一直在99,这很可怕,所以来调试. 使用top命令,得如下结果 PID USER PR NI VIRT RES SHR S %CPU %ME ...
- linux命令学习(一)—— 文件和目录管理命令
首先需要知道的是命令提示符 [root@localhost ~] # 当前登录用户(root) 主机名(localhost) 当前所在目录(家目录) 超级用户提示符(#) 普通用户提示符($) 1.1 ...
- java 正则表达式的应用:读取文件,获取其中的电话号码
1.正则表达式 正则表达式,又称正规表示法.常规表示法(英语:Regular Expression,在代码中常简写为regex.regexp或RE),计算机科学的一个概念.正则表达式使用单个字符串来描 ...
- BootStrap学习(2)
使用Bootstrap添加代码框 可先看:简介.引入.包下载等:http://www.cnblogs.com/0201zcr/p/4900062.html Bootstrap 允许您以两种方式显示代码 ...