The build.xml file is to Ant what a makefile is to make.
Althoug build.xml is an
xml file, there is no
dtd nor a
schema to validate it! The document, however, must be
well formed.
Ant can be instructed to use a differently named build.xml file by using the
-f option.
Sample build.xml
Tags
A build.xml file can contain the following tags:
project
It can contain the following attributes:
name
This attribute names the project.
default
This attribute specifies the default target. That is, the target to be run if none is specified on the command line.
basedir
This attribute specifies the base directory that is used to construct absolute paths from relative paths.
basedir behaves like a property: it can be overriden on the command line:
target
A target names a set of tasks that are executed when this target is run. A default target can be specified with the
default attribute in the
project element.
The following attributes can be specified:
name
Specifies the name of this target. In order to invoke a target, use this name on the command line:
This attribute is required.
default
???
if
The name of a property that must be set in order for a target to be executed. Consider the following file:
target_if
Just anting it:
prints
Buildfile: target_if.xml
print_something:
BUILD SUCCESSFUL
Total time: 0 seconds
If, however, the
property print_it is set:
ant -f target_if.xml -Dprint_it=1
Buildfile: target_if.xml
print_something:
[echo] print_it was set
BUILD SUCCESSFUL
Total time: 0 seconds
depends
Lists (comma seperated) all targets on which this target depends. That is, it first makes all other targets (if necessary) before it makes this target.
description
????
javac
Invokes the java compiler (
javac).
The following attributes can be specified:
srcdir
destdir
debug
deprecation
optimize
classpath
The following attributes can be specified:
refid
property
file
name
value
path
id
pathelement
location
fileset
dir
copy
todir
mkdir
dir
echo
Prints a message to the console.
message
Specifies the message to be printed.
echo.xml
<project default="print_something">
<target name="print_something">
<echo message="Here's a secret message" />
</target>
</project>
If this file (named echo.xml) is invoked with Ant, it prints:
Buildfile: echo.xml
print_something:
[echo] Here's a secret message
BUILD SUCCESSFUL
Total time: 0 seconds
A property's value can be echoed by placing like so:
echo_property.xml
Now, ant'ing this file:
Buildfile: echo_property.xml
print_something:
[echo] The value of foo is bar
BUILD SUCCESSFUL
Total time: 0 seconds
echo_property.xml can be used to demonstrate the effect of
ant's -D option:
ant -f echo_property.xml -Dfoo="overriding bar's default"
Buildfile: echo_property.xml
print_something:
[echo] The value of foo is overriding bar's default
BUILD SUCCESSFUL
Total time: 0 seconds
javadoc
The following attributes can be specified:
sourcepath
destdir
packagenames
taskdef
name
????
classname
????
分享到:
相关推荐
build.xml 手写自动生成Hibernate映射文件和配置文件源代码
参照ant的jakarta-ant-1.6alpha的build.xml Copyright (c) 2002 The Neusoft Software Foundation. All rights reserved. ======================================================================= --> <!-...
jmeter+ant 持续集成build.xml文件,直接使用ant命令执行jmeter脚本文件,得到图形测试报告
ANT-build.xml文件详解 ANT-build.xml文件详解 ANT-build.xml文件详解 ANT-build.xml文件详解
对build.xml文件中用到的标签进行了详尽的解说,并且附有例子,ant build.xml文件详解
构建自动化测试平台的时候需要新建的build.xml文件
开源ant的build.xml的一些属性配置,内含 几个例子。比较实用
ANT_发布项目中_build.xml_文件的详细配置
jmeter+ant+jenkins---build.xml文件,下载运行即可成功
java项目打包build.xml文件 ant打包
ant做的一个小例子,里面有build.xml的详细配置,导入myEclipse后可直接运行。
演示 build.xml 是编写方法,适合 ant build 初学者,解压,进入 ant 目录, 运行命令 ant 既可
NULL 博文链接:https://siwind.iteye.com/blog/1473839
ant打包项目的build.xml配置
jmeter实现接口自动化测试: 1)buil.xml文件实现了测试报告和发邮件 2)优化后的报告模板:jmeter-results-newreport.xsl
一个普通java程序用ant打包的列子,完整的,里面采用的是eclipse自带的编译插件进行的打包,需要结合eclipse中的插件一起使用
EJB的Ant配置文件build.xml,每段代码附有中文说明,通俗易懂,还根据不同版本的JBoss有不同的配置说明,以及需要修改的点。本人使用的是JBoss7.1.1,这其中也说明了更老版本的配置方式,完全能理解修改
NULL 博文链接:https://kanpiaoxue.iteye.com/blog/1995837
第一次做jmeter+ant自动化接口测试,需要build文件,开始直接copy博客中的内容,格式不对,调试好久不成功;后发现在jmeter/extras文件夹中有一个build文件,copy出来根据需要修改下,成功了,特上传自选供大家使用...
ant +build.xml 文件Jenkins部署javaEE项目,助力成功自动化部署。ant +build.xml 文件Jenkins部署javaEE项目,助力成功自动化部署。ant +build.xml 文件Jenkins部署javaEE项目,助力成功自动化部署。ant +build.xml...