Ant常用命令 您所在的位置:网站首页 Ant复制文件copy命令 Ant常用命令

Ant常用命令

2024-06-26 10:49| 来源: 网络整理| 查看: 265

第一部分 基本结构

说明: 标准的XML文档, 根结点为project, 前面可以设置公有变量property, project中可含多个target, 每个target中可包括多个task.

------------------------------------

第二部分 应用程序基本结构

目录 文件 bin 公共的二进制文件, 以及运行脚本 build 临时创建的文件, 如类文件等 dist 目标输出文件, 如生成Jar文件等 doc/javadocs 文档 lib 需要导入的Java包, 即编辑过程中需要的包 src java源文件 web jsp, html等

------------------------------------

第三部分 核心TASK

1. copy 拷贝单个文件   

拷贝单个文件到目录   

拷贝目录           

拷贝目录下指定文件(两种方式均可)                       

          

2. copydir 拷贝目录

拷贝目录下指定内容

3. copyfile 拷贝单个文件

4. cvs 从CVS服务器得到指定package的项目, 将之下载到dest指定目录下

5. delete

删除当前目录和所有子目录下的bak文件

删除build下所有文件及子目录, 包括build目录本身也删除

deletes all files and subdirectories of build, including build itself.

6. deltree deletes the directory dist, including its files and subdirectories.

deletes the directory ${dist}, including its files and subdirectories.

7. ear

8. echo This is a longer message stretching over two lines. This is a longer message stretching over three lines; the first line is a blank 只有当debug模式时才输出

9. exec 执行某程序

    

10. import Imports targets from the common-targets.xml file that is in a parent directory.

Imports the project defined by the property deploy-platform

11. input 执行过程中请用户输入y/n, 根据输入做出不同操作 Build aborted by user.

12. jar

    

13. java                                                         

14. javac compiles all .java files under the ${src} directory, and stores the .class files in the ${build} directory. The classpath used includes xyz.jar, and compiling with debug information is on.

   compiles all .java files under the ${src} directory, and stores the .class files in the ${build} directory. This will fork off the javac compiler using the default javac executable.

compiles all .java files under the ${src} directory, and stores the .class files in the ${build} directory. This will fork off the javac compiler, using the executable named java$javac.exe. Note that the $ sign needs to be escaped by a second one.

compiles .java files under the ${src} directory, and stores the .class files in the ${build} directory. The classpath used includes xyz.jar, and debug information is on. Only files under mypackage/p1 and mypackage/p2 are used. All files in and below the mypackage/p1/testpackage directory are excluded from compilation.

is the same as the previous example, with the addition of a second source path, defined by the property src2. This can also be represented using nested elements as follows:

                         If you want to run the javac compiler of a different JDK, you should tell Ant, where to find the compiler and which version of JDK you will be using so it can choose the correct command line switches. The following example executes a JDK 1.1 javac in a new process and uses the correct command line switches even when Ant is running in a Java VM of a different version:

指定了版本号

15. javadoc

Test]]> Copyright © 2000 Dummy Corp. All Rights Reserved.]]>       The ${buildname} nightly build has completed           

Sends an eMail from to with a subject of Test Build. Replies to this email will go to . Any zip files from the dist directory are attached. The task will attempt to use JavaMail and fall back to UU encoding or no encoding in that order depending on what support classes are available. ${buildname} will be replaced with the buildname property's value.

17. mkdir creates a directory ${dist}.

creates a directory ${dist}/lib.

18. move move与copy类似, 不同的是, 不留原稿 Move a single file (rename a file)

Move a single file to a directory

Move a directory to a new directory     

Move a set of files to a new directory                        

Append ".bak" to the names of all files in a directory.                      

19. property sets the property foo.dist to the value "dist".

reads a set of properties from a file called "foo.properties". 从文件中获取, 把属性做成一个单独的文件



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有