当前位置: 首页 > 编程日记 > 正文

编译工具 之 ant

一、概述

    需要设置的环境变量:
        JAVA_HOME="D:\JDK",
        ANT_HOME="D:\ant",
        PATH=".,%JAVA_HOME%\bin,%ANT_HOME%bin"
    运行:ant -buildfile test.xml -Dbuild=build/classes dist
(含义为:执行test.xml的编译脚本,参数build的值为build/classes,要执行的target为dist)
    默认的编译脚本为build.xml,默认的target为编译脚本中的project的default属性值所对应的target

二、常用task

    编译脚本是xml文档,元素有project->target->task,property,filter。
(右击前面查看图片)
    task有内置的和可选的之分,可选task需要下载额外的包来支持,此外可以编写自己的task。

1、Echo

Parameters

AttributeDescriptionRequired
messagethe message to echo.Yes, unless data is included in a character section within this element.
filethe file to write the message to.No
appendAppend to an existing file?No - default is false.
levelControl the level at which this message is reported. One of "error", "warning", "info", "verbose", "debug"No - default is "warning".

Examples

<echo message="Hello, world"/>
<echo message="Embed a line break:${line.separator}"/>
<echo>Embed another:${line.separator}</echo>
<echo>This is a longer message stretching over
two lines.
</echo>

2、Javac

Parameters(not all)

AttributeDescriptionRequired
srcdirLocation of the java files. (See the note below.)Yes, unless nested <src> elements are present.
destdirLocation to store the class files.No
includesComma- or space-separated list of files (may be specified using wildcard patterns) that must be included; all .java files are included when omitted.No
includesfileThe name of a file that contains a list of files to include (may be specified using wildcard patterns).No
excludesComma- or space-separated list of files (may be specified using wildcard patterns) that must be excluded; no files (except default excludes) are excluded when omitted.No
excludesfileThe name of a file that contains a list of files to exclude (may be specified using wildcard patterns).No
classpathThe classpath to use.No
sourcepathThe sourcepath to use; defaults to the value of the srcdir attribute (or nested <src> elements). To suppress the sourcepath switch, use sourcepath="".No

Examples

<javac srcdir="${src}"
destdir="${build}"
includes="mypackage/p1/**,mypackage/p2/**"
excludes="mypackage/p1/testpackage/**"
classpath="xyz.jar"
debug="on"
/>

3、jar

Parameters(not all)

AttributeDescriptionRequired
destfilethe JAR file to create.Yes
basedirthe directory from which to jar the files.No
compressNot only store data but also compress them, defaults to true. Unless you set the keepcompression attribute to false, this will apply to the entire archive, not only the files you've added while updating.No
keepcompressionFor entries coming from existing archives (like nested zipfilesets or while updating the archive), keep the compression as it has been originally instead of using the compress attribute. Defaults false. Since Ant 1.6No
encodingThe character encoding to use for filenames inside the archive. Defaults to UTF8. It is not recommended to change this value as the created archive will most likely be unreadable for Java otherwise.No
filesonlyStore only file entries, defaults to falseNo
includescomma- or space-separated list of patterns of files that must be included. All files are included when omitted.No
includesfilethe name of a file. Each line of this file is taken to be an include patternNo
excludescomma- or space-separated list of patterns of files that must be excluded. No files (except default excludes) are excluded when omitted.No
excludesfilethe name of a file. Each line of this file is taken to be an exclude patternNo
defaultexcludesindicates whether default excludes should be used or not ("yes"/"no"). Default excludes are used when omitted.No
manifestthe manifest file to use. This can be either the location of a manifest, or the name of a jar added through a fileset. If its the name of an added jar, the task expects the manifest to be in the jar at META-INF/MANIFEST.MFNo

Examples

<jar destfile="${dist}/lib/app.jar"
    basedir="${build}/classes"
    includes="mypackage/test/**"
    excludes="**/Test.class" />

<jar destfile="${dist}/lib/app.jar">
    <fileset dir="${build}/classes"
            excludes="**/Test.class" />
     <fileset dir="${src}/resources"/>
</jar>

4、javadoc

Parameters(not all)

AttributeDescriptionAvailabilityRequired
sourcepathSpecify where to find source filesallAt least one of the three or nested <sourcepath>, <fileset> or <packageset>
sourcepathrefSpecify where to find source files by reference to a PATH defined elsewhere.all
sourcefilesComma separated list of source files -- see also the nested source element.all
destdirDestination directory for output filesallYes, unless a doclet has been specified.
maxmemoryMax amount of memory to allocate to the javadoc VMallNo
packagenamesComma separated list of package files (with terminating wildcard) -- see also the nested package element.allNo
packageListThe name of a file containing the packages to process1.2+No
classpathSpecify where to find user class filesallNo

Example

  <javadoc packagenames="com.dummy.test.*"
sourcepath="src"
excludepackagenames="com.dummy.test.doc-files.*"
defaultexcludes="yes"
destdir="docs/api"
author="true"
version="true"
use="true"
windowtitle="Test API">
<doctitle><![CDATA[<h1>Test</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright &#169; 2000 Dummy Corp. All Rights Reserved.</i>]]></bottom>
<tag name="todo" scope="all" description="To do:" />
<group title="Group 1 Packages" packages="com.dummy.test.a*"/>
<group title="Group 2 Packages" packages="com.dummy.test.b*:com.dummy.test.c*"/>
<link offline="true" href="http://java.sun.com/products/jdk/1.2/docs/api/" packagelistLoc="C:\tmp"/>
<link href="http://developer.java.sun.com/developer/products/xml/docs/api/"/>
</javadoc>

转载于:https://www.cnblogs.com/menghe/articles/98020.html

相关文章:

微酷WeiKuCMS现赠送高速开发系统软件。公司、程序猿的福音呀!

我国电子商务面临的问题。淘宝退出百度无疑是一个遗憾。当在网上购物时。用户面临的一个非常大的问题就是怎样在众多的站点找到自己想要的物品。并以最低的价格买到。自从淘宝退出百度。建立自己的搜索引擎后。广大消费者再也不能再百度里面直接搜索有关淘宝的商品了&#xff0…

网友为对百合所唱的最后的挽歌!(节选)

dudu&#xff0c;不要删好吗&#xff0c;太郁闷了&#xff0c;太郁闷了&#xff0c;太郁闷了 sigh, 如果真的3.20日是末期的话&#xff0c;我所承诺的开源&#xff0c;只不过是一个玩笑罢了 参见&#xff1a;http://bbs.nju.edu.cn/blogall 网友为对百合所唱的最后的挽歌&#…

人工智能入门(二):语音识别基本模型

spectral analysis和formants&#xff0c;倒频谱&#xff0c;mel谱等feature有关&#xff1b; training和recognition涉及到&#xff1a;基础的&#xff08;DWT&#xff0c;HMM&#xff0c;Viterbi等&#xff09;&#xff1b;高阶的&#xff08;deep learning等&#xff09;。…

也谈文件夹同步

前言 1 同步分为文件级别&#xff0c;和块级别。rsync是块级别。 2 如果是基于微软文件共享或samba协议&#xff0c;用robocopy.exe即可文件级别的同步。 3 通过任务计划&#xff0c;实现自动&#xff0c;定时同步。 4 如果是ftp&#xff0c;sftp&#xff0c;用powershellwinsc…

几则与西门子相关的消息

西门子称手机部门前途未定 力推WiMAX系统 http://www.sina.com.cn 2005年02月15日 12:11 新浪科技 新浪科技讯 美国当地时间2月14日(北京时间2月15日)消息&#xff0c;在日前于法国戛那举行的“3GSM世界大会”上&#xff0c;西门子手机部门将何去何从再次被业界所关注。但西门…

CSS之定位(固定定位)

固定定位&#xff1a; <!DOCTYPE html> <html><head><meta charset"utf-8" /><title>固定定位</title><style>body{font-size: 60px;height: 2000px;}.box1{width: 200px;height: 200px;background-color: #bfa;}.box2{w…

在页面中控制媒体流的起播点和播放长度

近来在一个web项目中&#xff0c;客户提出需要在试听的音频文件中&#xff0c;输入开始时间和结束时间&#xff0c;然后从开始时间播放&#xff0c;到结束时间停止。在google中搜索了几次&#xff0c;都找不到相关的文档&#xff0c;只有自己进行研究了。刚开始的时候&#xff…

CSS之定位(粘滞定位)

粘滞定位&#xff1a; <!DOCTYPE html> <html><head><meta charset"UTF-8"><title>粘滞定位</title><style>body{height: 3000px;}/*粘滞定位-当元素的position属性值设置为sticky时开启元素的粘滞定位-粘滞定位和相对定…

链表的经常使用操作

链表的经常使用操作 posted on 2017-06-18 10:38 mthoutai 阅读(...) 评论(...) 编辑 收藏 转载于:https://www.cnblogs.com/mthoutai/p/7043708.html

从零打造在线网盘系统之Hibernate框架起步

欢迎浏览Java工程师SSH教程从零打造在线网盘系统系列教程,本系列教程将会使用SSH(Struts2SpringHibernate)打造一个在线网盘系统,本系列教程是从零开始,所以会详细以及着重地阐述SSH三个框架的基础知识,第四部分将会进入项目实战,如果您已经对SSH框架有所掌握,那么可以直接浏览…

Mr Big [To be with you]

很惊喜&#xff0c;在musictea上看到了Mr Big的专辑Lean Into It&#xff0c;里面则是包含了他最出名的To be with you 赶忙去听&#xff0c;果然是原汁原味的To be with you&#xff0c;相比而言&#xff0c;westlife的翻唱版则是夹杂了popmusic的那种浮华。还是很喜欢这种摇滚…

2018.11.12

1、CSS3新增选择器&#xff0c;新增伪类选择器 3、动画规则&#xff1a; keyframes创建动画&#xff0c;规定动画属性&#xff1a; animation 所有动画属性的简写4、其他待看样式多列、用户界面、图片、按钮、分页、框大小、弹性盒子、多媒体查询 2、样式属性…

使用Singleton需要考虑内存释放

GoF[p84]所说的Singleton没有考虑到内存的释放解决方法&#xff1a;1、加入一个成员函数DestroyInstance&#xff08;&#xff09;来释放内存&#xff0c;在整个工程中需且仅需调用DestroyInstance&#xff08;&#xff09;一次。2、ME中说用智能指针 转载于:https://www.cnblo…

搭建基于Spring Cloud的微服务应用

原文链接 在2017云栖大会-上海峰会上阿里云技术专家李斌做了题为《搭建基于spring Cloud的微服务应用》的分享。随着时代的发展&#xff0c;用户对于应用服务的要求越来越高&#xff0c;单体应用已经无法满足用户。这就使得微服务应用顺势而生&#xff0c;利用Spring Cloud为用…

CSS之定位(绝对定位元素的布局)

绝对定位元素的布局&#xff1a; <!DOCTYPE html> <html><head><meta charset"UTF-8"><title>绝对定位元素的布局</title><style>.box1{width: 500px;height: 500px;background-color: #7FFFD4;position: relative;}.box…

【转】学习汇编前你应该知道的知识

转载地址&#xff1a;http://www.zxbc.cn/html/20070611/22772.html 1、汇编需要什么工具和程序&#xff0c;到哪里下载&#xff1f;目前阶段&#xff0c;汇编程序仅需要两个程序就够了。masm.exe,link.exe。 前者是编译程序&#xff0c;后者是链接程序。另外&#xff0c;为了验…

Visual C#弹出窗口杀手

2002-11-19 ASPCool.com 弹出窗口杀手是一个可以自动关闭IE弹出窗口的程序&#xff0c;它工作在系统的托盘中&#xff0c;按照一定的间隔来检测IE窗口&#xff0c;然后关闭弹出窗体。最后&#xff0c;还提供了用热键来杀掉弹出窗口的功能。   虽然已经有类似的用C写的程序&am…

在Vue的webpack中结合runder函数

在Vue的webpack中结合runder函数 1.引入: <h1>下面是vue的内容:</h1><div id"app"><login></login> </div>2.main.js //默认无法打包vue文件 需安装vue-loader import Vue from vue import login from ./login.vuevar vm new…

CSS之定位(元素的层级z-index)

元素的层级z-index: <!DOCTYPE html> <html><head><meta charset"UTF-8"><title>绝对定位元素的布局</title><style>.box1{width: 500px;height: 500px;background-color: #7FFFD4;position: relative;}.box2{width: 100…

忍不住要发感慨,我的这个罗技鼠真好用...

终于忍不住了&#xff0c;把台式机上的罗技鼠换到了本本上&#xff0c;我这个当初花了100元买的罗技鼠真的是好用&#xff0c;至少对我而言如是。总感觉我的那个极动鲨有些厚重&#xff0c;虽然他也一样好用&#xff0c;但同这个罗技鼠相比&#xff0c;却多了分厚重&#xff0c…

五种常用的JavaScript自定义对象方式

一、直接创建方式&#xff1a; 例子&#xff1a; var student new Object(); student.name"Kate"; student.doSprot function(name){console.log(name"正在跑步。。。") } //调用 console.log(student.name); student.doSprot("小红"); conso…

LabelButtonScale

top.geometry()设定窗口的初始大小 scale.set()设定滑块的初始值 scale.get()获取滑块变化的值 控件通过回调函数与其他控件进行通信&#xff08;Label控件中的文本会受到Scale控件上操作的影响&#xff09; 转载于:https://www.cnblogs.com/TmHm/p/9949947.html

《The Sixth Sense》(《灵异第六感》)观后

记得在学校的时候看过一部片子《左眼看到鬼》&#xff0c;现在想想那部片子有抄袭《Tht Sixth Sense》的嫌疑。不过抄袭也差得远。 现在真的懒得看港台片了&#xff0c;国内的农村&#xff0c;山村题材的都比港台的垃圾片好很多,至少还有几分真。 看了《The Sixth Sense》不得不…

mysql基本命令行

连接登录数据库 mysql -h 127.0.0.1 -P 3306 -u root -p123456 查看数据库 mysql> show databases; 进入数据库test mysql> use test; 查看test数据库中所有表 mysql> show tables; 查看表student的创建语言 mysql> show create table student \g; 查看表student的…

【备忘1】防止表格/层 被撑破的CSS控制代码

①防止表格被宽度过大的图片撑破限制大图片显示尺寸img {max-width: 550px; width:expression(this.width > 550 ? "550px" : this.width)}②防止表格被字符撑破做到既防止表格/层撑破又防止单词断裂了table {table-layout: fixed;word-wrap:break-word;}div {wo…

修改ecshop的100种技巧

1: 如何修改网站 " 欢迎光临本店 " 回答 :languages/zh_cn/common.PHP 文件中&#xff0c; $_LANG[welcome] 欢迎光临本店 ; 将他修改成你需要的字样。 2: 如何修改首页 " 热门搜索关键字 " 回答 : 后台 -> 系统设置 -> 网店设置 -> 显示设置 -…

用js 判断datagrid 中的 checkbox 是否被选中

privatevoidPage_Load(objectsender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 this.sqlDataAdapter1.Fill (this.dataSet11 ); this.DataGrid1.DataSourcethis.dataSet11.Tables[0]; this.DataGrid1 .…

Navicat新建查询快捷键

在Navicat中&#xff0c;我们选中一个表&#xff0c;双击打开&#xff0c;这是如果要新建查询这个表的sql语句&#xff0c;可以直接用快捷键 ctrlq 会自动打开查询窗口&#xff0c;并直接写好 sql&#xff1a;select * from &#xff08;当前打开的表名&#xff09; 我们直接…

用JavaScript实现在网页中显示时间表

<!DOCTYPE html> <html><head><meta charset"UTF-8"><title>内置对象</title><style>#time{display: block;font-size: 50px;font-family: "微软雅黑";background-color: antiquewhite;text-align: center;}<…

分布式数据库概述

1&#xff0e;前言 随着传统的数据库技术日趋成熟、计算机网络技术的飞速发展和应用范围的扩充&#xff0c;数据库应用已经普遍建立于计算机网络之上。这时集中式数据库系统表现出它的不足&#xff1a;数据按实际需要已在网络上分布存储&#xff0c;再采用集中式处理&am…