首先安装ANT
假定Ant安装在c:\ant\目录下。下面是设定环境的命令:
set ANT_HOME=c:\ant
set JAVA_HOME=c:\j2sdk1.4.1
set PATH=%PATH%;%ANT_HOME%\bin运行Ant非常简单,当你正确地安装Ant后,只要输入ant就可以了。没有指定任何参数时,Ant会在当前目录下查询build.xml文件。如果找到了就用该文件作为buildfile。如果你用-find 选项。Ant就会在上级目录中寻找buildfile,直至到达文件系统的根。要想让Ant使用其他的buildfile,可以用参数-buildfile file,这里file指定了你想使用的buildfile的文件名。你也可以设定一些属性,以覆盖buildfile中指定的属性值(参看property task)。可以用 -Dproperty=value 选项,这里property是指属性的名称,而value则是指属性的值。也可以用这种办法来指定一些环境变量的值。你也可以用property task来存取环境变量。只要将 -DMYVAR=%MYVAR% (Windows) 或 -DMYVAR=$MYVAR (Unix) 传递给Ant -你就可以在你的buildfile中用${MYVAR}来存取这些环境变量。还有两个选项-quite,告诉Ant运行时只输出少量的必要信息,如:BUILD SUCCESSFUL。而-verbose,告诉Ant运行时要输出更详细的信息。可以指定执行一个或多个target。当省略target时,Ant使用标签<project>的default属性所指定的target。
-projecthelp选项输出项目的描述信息和项目target的列表。先列出那些有描述的,然后是没有描述的target。命令行选项总结:ant [options] [target [target2 [target3] ...]]Options:
-help print this message
-projecthelp print project help information
-version print the version information and exit
-quiet be extra quiet
-verbose be extra verbose
-debug print debugging information
-emacs produce logging information without adornments
-logfile <file> use given file for log output
-logger <classname> the class which is to perform logging
-listener <classname> add an instance of class as a project listener
-buildfile <file> use specified buildfile
-find <file> search for buildfile towards the root of the filesystem and use the first one found
-D<property>=<value> set property to value 例子ant
使用当前目录下的build.xml运行Ant,执行缺省的target。ant -buildfile test.xml
使用当前目录下的test.xml运行Ant,执行缺省的target。ant -buildfile test.xml dist
使用当前目录下的test.xml运行Ant,执行一个叫做dist的target。ant -buildfile test.xml -Dbuild=build/classes dist
使用当前目录下的test.xml运行Ant,执行一个叫做dist的target,并设定build属性的值为build/classes。Ant的buildfile是用XML写的。每个buildfile都含有一个project。
常用的元素有"project"、"target"、"path"、"property"等。
常用的任务有"ant"、"mkdir"、"delete"、"copy"、"javac"、"jar"、"javadoc"、"echo"等以上只是该工具的一点皮毛,熟能生巧,相信不久你也能够运用自如了!
GOOD LUCK!
假定Ant安装在c:\ant\目录下。下面是设定环境的命令:
set ANT_HOME=c:\ant
set JAVA_HOME=c:\j2sdk1.4.1
set PATH=%PATH%;%ANT_HOME%\bin运行Ant非常简单,当你正确地安装Ant后,只要输入ant就可以了。没有指定任何参数时,Ant会在当前目录下查询build.xml文件。如果找到了就用该文件作为buildfile。如果你用-find 选项。Ant就会在上级目录中寻找buildfile,直至到达文件系统的根。要想让Ant使用其他的buildfile,可以用参数-buildfile file,这里file指定了你想使用的buildfile的文件名。你也可以设定一些属性,以覆盖buildfile中指定的属性值(参看property task)。可以用 -Dproperty=value 选项,这里property是指属性的名称,而value则是指属性的值。也可以用这种办法来指定一些环境变量的值。你也可以用property task来存取环境变量。只要将 -DMYVAR=%MYVAR% (Windows) 或 -DMYVAR=$MYVAR (Unix) 传递给Ant -你就可以在你的buildfile中用${MYVAR}来存取这些环境变量。还有两个选项-quite,告诉Ant运行时只输出少量的必要信息,如:BUILD SUCCESSFUL。而-verbose,告诉Ant运行时要输出更详细的信息。可以指定执行一个或多个target。当省略target时,Ant使用标签<project>的default属性所指定的target。
-projecthelp选项输出项目的描述信息和项目target的列表。先列出那些有描述的,然后是没有描述的target。命令行选项总结:ant [options] [target [target2 [target3] ...]]Options:
-help print this message
-projecthelp print project help information
-version print the version information and exit
-quiet be extra quiet
-verbose be extra verbose
-debug print debugging information
-emacs produce logging information without adornments
-logfile <file> use given file for log output
-logger <classname> the class which is to perform logging
-listener <classname> add an instance of class as a project listener
-buildfile <file> use specified buildfile
-find <file> search for buildfile towards the root of the filesystem and use the first one found
-D<property>=<value> set property to value 例子ant
使用当前目录下的build.xml运行Ant,执行缺省的target。ant -buildfile test.xml
使用当前目录下的test.xml运行Ant,执行缺省的target。ant -buildfile test.xml dist
使用当前目录下的test.xml运行Ant,执行一个叫做dist的target。ant -buildfile test.xml -Dbuild=build/classes dist
使用当前目录下的test.xml运行Ant,执行一个叫做dist的target,并设定build属性的值为build/classes。Ant的buildfile是用XML写的。每个buildfile都含有一个project。
常用的元素有"project"、"target"、"path"、"property"等。
常用的任务有"ant"、"mkdir"、"delete"、"copy"、"javac"、"jar"、"javadoc"、"echo"等以上只是该工具的一点皮毛,熟能生巧,相信不久你也能够运用自如了!
GOOD LUCK!
解决方案 »
- 请问MYSQL 使用连接池功能应如何设置 DRIVERCLASS
- DataInputStream关闭的问题
- 关于数据库的效率问题
- 如何理解Session
- 一个连接的问题,大家多给意见
- dom4j解析xml与HashMap的怪问题!
- Servlet读取sql server数据库时报错:
- WEBLOGIC里配连接池时的ACLName是什么意思?
- {weblogic7+jb8 }在jb8中启动weblogic7的问题
- 实战EJB之四(开发实体CMP),在部署应用程序的时候,点击"实体EJB的持续性管理",”在设置数据源的JNDI名时,如何修改datasources.xml来
- b/s和MVC有什么区别啊?谢~~
- 怎么解决这个问题啊~偶都快晕了~呜呜呜呜呜呜瓦
Ant 是一个编译工具, myftp() 说得很清楚
请看以下连接:
http://www.chedong.com/tech/ant.html
http://www.chinajavaworld.net/doc/wangyou/qiwang/ant_practice.htm
Xero说的对,ANT只是一个基于JAVA的编译工具,只要你在环境变量PATH中有设置ANT_HOME\bin,你就可以在任何路径下使用它了。
GOOD LUCK!
Ant初步
http://www.zdnet.com.cn/developer/tech/story/0,2000081602,39098978,00.htm