target goals and tasks

2011-05-14  来源:本站原创  分类:Development  人气:115 

Run ant not the case with the parameters, reads the project elements, and use the default attribute as a target implementation.

ant task to support all three attributes:
id, the unique identifier of a task instance. Used in conjunction with the Reference type.
taskname, the task instance name, will appear in the log.
description, the task of the comments.

<project> and <target> elements are not tasks.

project element attributes
basedir the base directory relative path for all projects are based on the value. The default is the component file directory. If this attribute is not specified, you can add features when calling ant ant-Dbasedir = directory target (target name to be called)

default to specify a goal, to bring goal if the ant command is not, the default implementation of this goal.

name the name of the project. Used to create documents. When the ant-projecthelp name is also displayed.

It can be nested sub-elements:
0-N a description for the project to create a description. When the ant-projecthelp will display this description.
0-N a filelist element defines the scope of the filelist
0-N a fileset element defines the scope of the fileset
0-N a filterset element defines the scope of filterset
0-N a mapper element
0-N a path element
0-N a property element
1-N a target element
0-N a taskdef element

target element attributes
dependence on target this goal depends, separated by commas. Lists the target will be executed before this target.
description to describe the objective.
specify a property name if, and only features in the set will perform.
name must be the target name
unless specify a feature name, not set properties before implementation.

Objectives and tasks can include DataType.

ant tasks
ant task file based on another component called a target ant. Can define multiple component files for the project. Different ant versions of project are called, the transfer characteristics in different ways. Version 1.1, a new project called the project characteristics can be seen. If both projects are defined in the same property, then call the characteristics of the project priority.

Attributes:
antfile component to call the file name, default is build.xml
dir the base directory for new projects. antfile property relative to this directory to find. The default is the current directory.
inheritall control features to the current project is passed to the new project. The default is true. That the characteristics of the current project is available in the new project. false, the definition of the characteristics of the current project will not be passed to the new projects, unless they are defined in the ant command line (this time is the user features, not the characteristics of the component.)
output file name, output is written to the file.
target new project file name to be invoked. If omitted, the default will call the new project goals can be nested
0-N a property element, will be passed to the new project a feature
<ant antfile="email/build.xml">
<property name="test" value="test_value" />
</ Ant>

antcall task calling a target document the current component through the use of nested properties <param> element passed to the new target. antcall component uses the current file, and create a new instance, then call this goal.
Attributes:
inheritall and similar ant
target must be to call the target

0-N nested param elements were a feature of the process is passed to the new members. param elements and similar property. Properties are the same.

antstructure ant task to create a xml dtd. It uses java reflection to allow for all tasks to determine the properties and content. Because the ant task does not need that property, so the generated DTD attribute is # IMPLIED (expressed optional)
Properties
output to generate the DTD file name

apply the task to perform a system command. execon task has been abolished. And exec different tasks, this task requires nested fileset to specify one or more files and directories as a command parameter properties
dest generated by the commands of any object files destination directory.
working directory dir command
executable must be, to perform the command name, not including the command parameters
failonerror If true, if the command returns non-0 value, the component fails. The default is false
newenvironment, if it is true, the existing environment variable is not passed to the new process. The default is false
os this task can be applied to the operating system list, it will System.getProperty ("os.name") to acquire the system, and with the comparison. Will perform in the list of the
output to a file, it is necessary to redirect command output to the file
outputproperty store the name of the command output characteristics
parallel if it is true, then the command only once, all the files passed as parameters. If false, this command for each file to execute the order. The default is false.
skipemptyfilesets If true, when the source file is not found, or a new source file than the target file, not execute the command. The default is false.
timeout waiting for the termination order as high as the number of seconds before, if not specified, wait indefinitely.
Confirming format type or target of the names are sent to the command. Allowable value can be file, dir or both. The default is the file
vmlauncher specify whether you try to use the built-in command to start the jvm process, not a antRUN script, the default is true.
If you specify a nested <mapper> elements, dest to be.

Sub-elements can be nested
0-N a arg elements, command line parameters
0-N a env element, specify environment variables
0-N a fileset element to specify which files and directories to be passed as parameters to the command. Unless specified srcfile element, otherwise the file will be appended to the end of the command line.
0-N a mapper element, if defined, will be the target file and source file timestamp timestamp comparison.
0-N a srcfile element, if present, then the file specified by the fileset element to be placed to control where the command line. srcfile not have any attributes. Elements need to be placed between the right arg.
0-N a targetfile element that apply only to set a mapper element element and destdir attributes to be available. No property. On the command line used to mark the location of the destination file. And srcfile elements the same.
<? Xml version = "1.0" encoding = "utf-8"?>
<project name="DataType Test " default="run" basedir=".">
<filelist dir="." files="1.txt, 2.txt, 3.txt" />
<filelist dir="." files="4.txt" />
<target name="run">
<tstamp>
<format property="starttime" pattern="yyyy-MM-dd hh:mm:ss" />
</ Tstamp>
<echo message=" Start time :${starttime}" />

<apply executable="dir" vmlauncher="false">
<fileset dir=".">
<include name="build.xml" />
</ Fileset>
</ Apply>

<tstamp>
<format property="endtime" pattern="yyyy-MM-dd hh:mm:ss" />
</ Tstamp>
<echo message=" End time :${endtime}" />
</ Target>
</ Project>
Results
D: \ source \ liyixing \ ant> ant
Buildfile: D: \ source \ liyixing \ ant \ build.xml

run:
[Echo] Start time :2011 -05-16 11:27:00
[Apply] the volume in drive D is IT
[Apply] Volume Serial Number is D0EA-6307
[Apply]
[Apply] D: \ source \ liyixing \ ant directory
[Apply]
[Apply] 2011-05-16 11:26 2,205 build.xml
[Apply] 1 files 2,205 bytes
[Apply] 0 directories 92,811,255,808 bytes available
[Echo] end time :2011 -05-16 11:27:01

BUILD SUCCESSFUL
Total time: 0 seconds

With output attributes, output = "a.txt" Results
D: \ source \ liyixing \ ant> ant
Buildfile: D: \ source \ liyixing \ ant \ build.xml

run:
[Echo] Start time :2011 -05-16 11:30:36
[Echo] end time :2011 -05-16 11:30:36

BUILD SUCCESSFUL
Total time: 0 seconds

the results of dir command to print in the a.txt. Open a.txt can see the results.

available
available if a resource is available, a feature set conditions. Resources can be a class, file, directory, or java system resources. If the resources exist, this property is set to true, or is set to value property values. Otherwise, not set properties.
Part of the task is not listed.

fail throwing an exception (BuildException) and terminate the current building. message is displayed when designated to perform this task in the message.
Properties
message to be displayed in the message.

jar
Create a jar file attributes
basedir to add to jar files in the base directory
compress If true, then extract the jar file. The default is true
defaultexcludes are using the default exclusion pattern. The default is true
jar file encoding name specified encoding default is utf-8.
excludes list of file patterns to exclude. Comma separated
excludesfile per line list to be excluded
model to include the file includes a list of comma-separated
includesfile Each line consists of a pattern to include files.
jarfile to create the jar file name
manifest file name list. If not specified, then, ant generates a new list, which will add the version number of ant.
update If true, then when changes occur to update the existing jar file. Rather than rebuild.
whenempty wrong input file was not found to do. Default is create. Fail to terminate the legal values are built. skip jar file does not create create create an empty jar file.
Can be nested
0-N an attribute element. Each element is a key pair. The manifest file is not named in the section. Use the list of paragraphs separated by blank lines. Create a list using the section above.
Attributes:
name attribute name
value attribute value
0-N a patternset elements (exclude, incude, patternset, excludesfile, includesfile) instead of its properties.

0-N a fileset elements included in the jar file in the specified files and directories.
0-N a metainf elements, define a fileset, which contains the jar to be placed in the META-INF directory of the file. If set in MANIFEST.MF file, then put this jar in the MANIFEST.MF file and merge.
0-N a section elements, each element defines a list of segments. Each section can contain attribute.
Attributes:
name, segment out.
0-N a zipfileset.

<? Xml version = "1.0" encoding = "utf-8"?>
<project name="DataType Test " default="run" basedir=".">
<filelist dir="." files="1.txt, 2.txt, 3.txt" />
<filelist dir="." files="4.txt" />
<target name="run">
<tstamp>
<format property="starttime" pattern="yyyy-MM-dd hh:mm:ss" />
</ Tstamp>
<echo message=" Start time :${starttime}" />

<jar jarfile="build/test.jar" basedir="src" includes="**/*.java">
<manifest>
<attribute name="Version" value="3.2" />

<section name="test1">
<attribute name="test1-1" value="test1-1" />
</ Section>

<section name="test2">
<attribute name="os" value="windows" />
</ Section>
</ Manifest>
</ Jar>

<tstamp>
<format property="endtime" pattern="yyyy-MM-dd hh:mm:ss" />
</ Tstamp>
<echo message=" End time :${endtime}" />
</ Target>
</ Project>
Generated a list of jar file content
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.6.0_22-b04 (Sun Microsystems Inc.)
Version: 3.2

Name: test1
test1-1: test1-1

Name: test2
os: windows

java
Specify a java class to use ant to create a new vm or vm to run java class.
If the code has System.exit (), to ensure that the fork = true, otherwise ant will exit.
Properties
args, deprecated, use the args element
classname, the implementation of the java class
classpath to use the class path. Unless the fork = true, otherwise they will be added to the ant classpath.
classpathref build file defines the application class path.
dir vm working directory. fork = true when it is valid.
failonerror, if not true, then the command returns 0 when the value of building failure. The default is false, fork = true when it is valid.
when fork is true, create a new VM instance. Default false.
jar jar to execute an executable file name. This jar file must include a list of Main-Class entry. And the fork must be true.
jvm java interpreter command name. The default is java. fork must be true.
jvmargs, deprecated use jvmarg elements.
maxmemory created for the new maximum amount of memory allocated vm. fork = true to be useful.
output a file name, output is written here
classname or two who must choose one of the jar.
Nested
0-N a arg or jvmarg element specifies the application of the parameters and the parameters of the virtual machine.
0-N system features a sysproperty specified
0-N a classpath element with a path instead of classpath or classpathref property.
<? Xml version = "1.0" encoding = "utf-8"?>
<project name="DataType Test " default="run" basedir=".">
<filelist dir="." files="1.txt, 2.txt, 3.txt" />
<filelist dir="." files="4.txt" />
<target name="run">
<tstamp>
<format property="starttime" pattern="yyyy-MM-dd hh:mm:ss" />
</ Tstamp>
<echo message=" Start time :${starttime}" />

<java classname="test.Test">
<arg value="123" />
<classpath>
<pathelement path="build" />
</ Classpath>
</ Java>

<tstamp>
<format property="endtime" pattern="yyyy-MM-dd hh:mm:ss" />
</ Tstamp>
<echo message=" End time :${endtime}" />
</ Target>
</ Project>

<? Xml version = "1.0" encoding = "utf-8"?>
<project name="DataType Test " default="run" basedir=".">
<filelist dir="." files="1.txt, 2.txt, 3.txt" />
<filelist dir="." files="4.txt" />

<path>
<pathelement path="build/test.jar" />
<pathelement path="build/1.jar" />
</ Path>

<target name="run">
<tstamp>
<format property="starttime" pattern="yyyy-MM-dd hh:mm:ss" />
</ Tstamp>
<echo message=" Start time :${starttime}" />

<java classname="test.Test">
<arg value="123" />
<classpath refid="test.classpath" />
</ Java>

<tstamp>
<format property="endtime" pattern="yyyy-MM-dd hh:mm:ss" />
</ Tstamp>
<echo message=" End time :${endtime}" />
</ Target>
</ Project>
Application path defined elsewhere

javac task
Compile the java file and class file comparison. If the file or source file does not exist than their corresponding class files updated, will be compiled. Dependencies, ant can not be found. A change such as the parent class, while the sub-class B inherits the parent class A, B unmodified, ant only recompile A, and will not re-compile B. There will be a special problem.
Supports a variety of compilers.
JDK1.1-12 compiler is a classic
JDK1.3/1.4 is modern.
IBM Jikes compiler jikes
Microsoft's javaSDK compiler jvc
kopi compiler kjc
compiler, gcc, gcj gcj
Symantec compiler sj
In its own JVM to run modern or classic extJavac
Properties
bootclasspath to start the bootstrap class path.
bootclasspathref application of the definition of the class path somewhere.
classpath to use the class path. If the fork is not true in the case, will add it to the ant classpath.
classpathref application classpath somewhere.
debug If true, debugging information will compile the source code. Default false
defaultexcludes are using the default exclusion pattern. Default true
depend if it is true, then the dependency check for compiler support (jikes and classic) start the dependency check. The default is false.
deprecation, if true, display obsolete warning. Default false
class files in the destination directory destdir
encoding of the source file character encoding
excludes
excludesfile
extdirs java installed optional package covers general location
failonerror If true, when there is an error, fails to build. The default is true
fork if true, java compiler as a new process. If set, this property will override build.compiler features. The implementation of ant JAVA_HOME / bin in the actual java executable. Rather than the compiler Main class. Default false
includeantruntime, if true, will be included in the ant runtime classpath. Default true
includejavaruntime, if it is true, include the running VM from the default runtime. The default is false.
includes
includesfile
memoryinitialsize time work when fork = true. Vm memory size is specified.
memorymaximumsize time work when fork = true. Specify the maximum memory for the vm
nowarn If it is true, to-nowarn parameter passed to the compiler. Default false
optimize if true, instructs the compiler to optimize code. Default false.
source if specified, this property file-source command-line arguments as passed to javac.
srcdir the location of the source code
specify a target version of vm
verbose If not true, then the compiler generates the display output. The default is false.
Src element unless specified otherwise, the properties of srcdir is necessary.

0-N can be nested one exclude, include, patternset, excludesfile, includesfile
0-N a bootclasspath, classpath, extdirs, src

相关文章
  • target goals and tasks 2011-05-14

    Run ant not the case with the parameters, reads the project elements, and use the default attribute as a target implementation. ant task to support all three attributes: id, the unique identifier of a task instance. Used in conjunction with the Refer

  • Ant tool in common core tasks. 2010-07-07

    Ant tool in the package of each task to perform specific functions, is the Ant tool basic unit of execution. Ant tool to provide many useful tasks, project developers may use the built-in Ant task tool provides convenient features such as automatic b

  • Software project development process with the idea 2009-04-22

    INTRODUCTION Computer software, especially database software, has become the mainstream of contemporary computer applications. Thus software developers must have the right to develop the means to understand the main software development process, so t

  • [Transfer] if I am a Project Director / Manager - My Hand My Heart 2010-10-13

    If I was a Project Director / Manager - My Hand My Heart switched http://baoqiangwang.blog.51cto.com/1554549/403926 For domestic small and medium private enterprises, the project director / manager role is most embarrassing. Project Director / Manage

  • VS2010 practice RUP4 +1 architecture model (1) 2010-12-10

    RUP4 +1 architectural approach Methods RUP4 +1 architecture use case driven, in all phases of software life cycle model of software, from a different perspective on the interpretation of the system to form a unified framework for software process des

  • Project task management platform 2010-08-04

    Project task management platform For corporate management, management tasks can be repeated to achieve communication, process reporting, evaluation and acceptance. 1, FORP design concept of management by objectives We know, through the management sof

  • Do the project process 2010-09-04

    Do the project, is certainly to explicit goals and plans, then the target down into tasks, assign tasks to people. Which in any project management are required.

  • The U.S. team - study notes 2011-04-12

    Tim O'Relly team: Let everyone do what they want to do, to do spontaneously. Through appropriate guidance, and to generate positive thoughts, thus changing their behavior. Like Pirates of the dream of space inside, as described under the idea implant

  • Control group analysis - and the task group initialization 2011-09-24

    Control group analysis - and the task group initialization Foreword introduced in front of the main control group and control group data structure file system design, the paper continues to be introduced to the control group, mainly including: the in

  • 学习笔记(更新中) 2011-06-16

    转自:http://macrochen.javaeye.com/blog/357308 maven=构建工具+依赖管理+项目生命周期管理 什么是maven插件的目标? maven插件相当于一个功能集合, 而目标就是这个功能集合中的一个子功能(任务), 比如help:effective-pom中help就是一个插件, effective-pom就是help插件的一个目标, 用来显示pom文件 help:describe几个比较有用的用法 查看一个插件的描述信息 如, mvn help:descri

  • Maven copy研究 2012-03-09

    引言: 由于没有使用过Maven和Ant,今天花了一下午的时间来研究把一个指定的文件copy到自己想要的文件夹中... 为什么要这样呢? 主要是因为applet部署在Tomcat上 其中applet的class 部署到Tomcat默认的WEB-INF中了,不能被访问到,开始的时候上网搜了许多 不知道是否是所说的认证和权限问题... 也做了一些research,后来不知道为什么就放弃了,于是现在需要把WEB-INF中的class copy出来到指定的可以由applet访问的 文件夹中. today

  • 6,maven生命周期和插件 2013-08-06

    一. 何为生命周期 Maven 的生命周期就是为了对所有的构建过程进行抽象和统一.这个生命周期包含了项目的清理.初始化.编译.测试.打包.集成测试.验证.部署和站点生成等几乎所有构建步骤. Maven 的生命周期是抽象的,不做任何实际工作,实际任务都交由插件完成.(这种思想与 template method 非常类似)每个构建步骤可以绑定一个或者多个插件行为. Maven 为大多数构建步骤编写并绑定了默认插件,如: maven-compiler-plugin 和 maven-surefire-p

  • Practical and does not fancy the js code complete 2009-04-30

    Event source object event.srcElement.tagName event.srcElement.type Capture Release event.srcElement.setCapture (); event.srcElement.releaseCapture (); Events button event.keyCode event.shiftKey event.altKey event.ctrlKey Event return values event.ret

  • js general reference service 2008-09-03

    document.all [ 'heading1']. style.fontSize = 'xx-small'; Event source object event.srcElement.tagName event.srcElement.type Capture Release event.srcElement.setCapture (); event.srcElement.releaseCapture (); Events button event.keyCode - Back to keyd

  • The creation and development of the project team 2010-03-09

    1. Forming stage The formative stages of the project team is the team's start-up and the formation stage, which is a group of individual members of the transition phase of the project team members. At this stage, the project team members from differe

  • Ant: Installation & Configuration 2010-05-02

    Abstract: ant is a JAVA-based automated scripting engines, script format is XML. In addition to compiling the relevant tasks to do JAVA, ANT can also be achieved through a lot of applications called plug-ins. The basic concept of ANT: ANT installatio

  • jquery document notes 2010-07-09

    To add a function to the page element, the element must wait for the loading is complete, otherwise it will add unsuccessful. Method of waiting for the document is loaded window.onload = function (){}; disadvantage of this method it is necessary to w

  • 7 large-scale web site design and maintenance of key skills 2010-07-30

    Collis Ta'eed once wrote a blog post " 7 Crucial Tips for Designing and Maintaining a Large Site ", for us to share the large-scale web site design and maintenance of key skills, alswl article has been translated into Chinese, is reproduced here

  • Application development and integration of Ant Xiangjie 2010-08-11

    Ant tool in the package of each task to perform specific functions, is the Ant tool basic unit of execution. Ant tools provide many useful tasks, project developers may use tools provided by the built-in Ant task automatically and easily build and so

  • The process of doing the project 2010-09-04

    A project, is certainly clear to the objectives and plans of, and then the target down into tasks, assign tasks to people. This is essential for any project management.