Section "Using Ant"
2004-07-22 13:14
453 查看
ant的使用就是这么的简单,更复杂的build.xml的写法可以参考ant的帮助文档 Developing Games in Java值得一看,很多地方虽然是点到即止,但重点绝不漏掉! Apache Ant is a free Java-based build tool and can be downloaded from http://ant.apache.org. Because Ant is Java-based, Ant build files can be compiled on any platform. Also, Ant is integrated into many Java IDEs, so you can get up and running quickly. Ant build files are XML files, usually named build.xml. Listing I.1 contains an example build file. Listing I.1 Sample Ant Build File (CSDN的blog贴不出xml格式文本。。。见下面回复内容) The sample Ant file almost describes itself. First, two properties are created to specify the srcdir and destdir directories. Properties can be referred to using the ${varName} syntax. The build file contains four targets: clean, compile, build, and rebuild. The compile target compiles all Java files in the source directory, putting the compiled class files in the destination directory. The clean target deletes all of these classes. The build target depends on the compile target, so running the build target automatically runs the compile target first. The build target packs all the compiled class files into a .jar file. Finally, the rebuild target does nothing by itself, but depends on the clean and build targets to perform a clean build. After you've got Ant installed, just open a command prompt in the directory of the build file and type in the target you wantto execute, like this:
antcompileThis command loads the build.xml file in the current directory and executes the compile target. If you were to name no target, as in the following, the build target is executed because it's defined to be the default target in the build file:
antBesides running Ant from the command line, Ant is also tightly integrated into many IDEs and text editors, such as JBuilder, jEdit, Eclipse, IDEA, and NetBeans. For example, in jEdit (see Figure I.1), the AntFarm plug-in enables you to browse Ant files, execute targets with the click of the mouse, and even send compile errors to jEdit's ErrorList plug-in so you can click on errors to go directly to the source of the compile error.
相关文章推荐
- "Cannot allocate memory" OutofMemory when call Ant to build Polish project in Tomcat
- 配置ant遇到"ANT_HOME is set incorrectly"错误。
- 002-Fatal error in launcher: Unable to create process using '""
- VC++中"using namespace std"有什么用的
- ubuntu14.10下解决"ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)"
- 关于gdb警告not using untrusted file "xx/.gdbinit"
- Be carefull when using string operating function declarated in "string.h"
- 用MyEciplse时 some character can not mapped using "iso-8859-1" character encoding 解决
- Using "RDP Encoder Mirror Driver" to Capture Screen
- php -- pecl 安装模块时出现"pear.php.net is using a unsupported protocal - This should never happen. install failed "错误
- Including header files using "" vs <>
- Error "ORA-28040: No matching authentication protocol" When Using SQLNET.ALLOWED_LOGON_VERSION (Doc
- 1202530 - Error: "HTTP Status 500"" when attempting to log on to Java InfoView using Active Directory(配置BOSSO出现的问题解决方案)
- omapl138平台,BIOS5.41系统warning: creating output section ".vecs" without a SECTIONS specification
- mySQLDriverCS Exception: MySQLDriverCS: can't connect Access denied for user "x"(using password:YES)
- Error:"encountered a section with no package header" when apt-get update
- 用MyEciplse时 some character can not mapped using "iso-8859-1" character encoding 解决
- Unable to find a value for "dwmc" in object of class "java.lang.String" using operator "." (null
- Some characters cannot be mapped using "GBK" character encoding
- Some characters cannot be mapped using "Cp1252" character encoding 解决方法