Section "Using Ant"

原创 2004年07月22日 13:14:00

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 want to execute, like this:

ant compile 

This 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:

ant 

Besides 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.

Section "Using Ant"

ant的使用就是这么的简单,更复杂的build.xml的写法可以参考ant的帮助文档 Developing Games in Java值得一看,很多地方虽然是点到即止,但重点绝不漏掉! Apache ...
  • summer419
  • summer419
  • 2004-07-22 13:14:00
  • 1022

Comparing ant and make as Java build tools

Comparing ant and make as Java build tools By GusherJizmac in Technology Mon Sep 24, 2001 at...
  • carolzhang8406
  • carolzhang8406
  • 2012-01-04 14:12:17
  • 1014

ClassLoader与Ant的一些问题

今天被这个Classloader搞死了。起因是这样的:public  static void  staticMethod(){    String resource = ClassLoader.get...
  • liujin4049
  • liujin4049
  • 2006-09-01 17:50:00
  • 2216

Publish failed using Ant publisher Resource is out of sync

这个问题是由于Eclipse内的文件和操作系统的文件不统一所引起的。 只需选中工程, F5 更新即可整个工程解决。 也可以找到你的workspace  把.metadata删除 在重启my...
  • beyond667
  • beyond667
  • 2012-12-21 23:17:23
  • 1217

flume+es+kibana日志系统

上个公司做了个日志系统,其实之间断断续续搞了三套方案,一套就是前边说的hadoop方案,网上也有但是不全,自己搞了下发现太庞大不适合小型项目,这次搞了flume+ES+kibana方案,感觉非常不错哦...
  • luqiang81191293
  • luqiang81191293
  • 2015-08-03 13:55:43
  • 7728

Verilog Tutorial (Verilog 教程)

This Verilog tutorial was started a long time ago. Every time I update my web page, I make sure I ...
  • wzb56
  • wzb56
  • 2012-11-21 09:27:24
  • 1115

taskdef class com.android.ant.SetupTask cannot be found using the classloader AntClassLoader

refs: http://stackoverflow.com/questions/15713871/taskdef-class-com-android-ant-setuptask-cannot-be...
  • Henry_Wu001
  • Henry_Wu001
  • 2016-01-25 11:13:52
  • 932

PR4E第六周笔记

str[0:5] 截取第一位到第四位的字符 str[:] 截取字符串的全部字符 str[4:] 截取第五个字符到结尾 str[:-3] 截取从头开始到倒数第三个字符之前 str[2] 截取第三...
  • Agony_CUPL
  • Agony_CUPL
  • 2015-03-15 02:33:08
  • 2933

使用ant让Android自动打包的build.xml,自动生成签名的apk文件(支持android4.0以上的版本)

记得去年自己写过一个ant脚本,但是在android4.0以后的sdk里那个脚本就失效了,主要是因为 apkbuilder这个程序不见了; 人家sdk升级,我们的脚本也要跟上趟,修改一下喽。 ...
  • changemyself
  • changemyself
  • 2013-12-12 10:56:25
  • 14216

Oracle SQL Tuning Pocket Reference

  • 2013年01月08日 20:53
  • 981KB
  • 下载
收藏助手
不良信息举报
您举报文章:Section "Using Ant"
举报原因:
原因补充:

(最多只允许输入30个字)