Home
Ant User Manual
Contents
1. 133 6 51 wo ea e me ae or a a a a a a a eS a a A 6 52 T wo A Me an a A te mate OC 36 6 53 te AP eet ie fae eae aaen e oak a ode a a 6 54 me lt Wi ets e we RO OOP tat te See poe oh tt ye 19 6 55 a Sle die Be aie nts gcd ee fe cn oe oe oA 6 56 Ce ee ie Wen a ee us a a ame a Tr E a a a er ae 2 e D a k ee ee ee 6 59 Zip am ee OM a ue Ot lm Sw we oy io 7 Optional Tasks SUS ek ie a ok Se Oe me te ee ee tO INET classes Tor Al Re Petite om ot Ags fe Oe be gh ee Uae ae OO ae ts 72 ANTER Seu Ee ae Bee Se a ee a oS Oe 0 S6 a i 157 ee a a A mw oe e oh a a Sl me ee ke te oe gt es ee es es be Lee O 76 Depend oh ow oe me ec Ue th em ek Oe el BIS Ant User Manual Table of Contents 168 189 194 197 200 202 204 206 208 215 220 222 224 226 228 229 231 234 241 244 248 249 250 252 254 256 257 259 260 s DE bete ae Ioko a w ee e e o a ee or a anes 265 265 266 266 276 276 10 ra be fe A ee Om ee oe e ae mee ees fo a a oe a we ae OE mn SO Ad US ae ck a 12 Feedback 2 eee Ae ae Ae ee ge gs OR ee 880 Ant User Manual 1 Introduction 1 Introduction Ant is a Java based build tool In theory it is kind of like make without make s wrinkles 1 0 1 Why Why another build tool when there is already make gnumake nmake jam and others Because all those tools have limitations that Ant s original author couldn t live with when
2. Behavior when no files match 6 59 3 Parameters specified as nested elements 6 59 3 1 fileset The zip task supports any number of nested p 25 elements to specify the files to be included in the archive 6 59 3 2 zipfileset A lt zipfileset gt has three additional attributes prefix fullpath and src The prefix and fullpath attributes modify the location of the files when they are placed inside the archive If the prefix attribute is set all files in the fileset are prefixed with that path in the archive If the fullpath attribute is set the file described by the fileset is placed at that exact location in the archive The fullpath attribute can only be set for filesets that represent a single file The prefix and fullpath attributes cannot both be set on the same fileset The src attribute may be used in place of the dir attribute to specify a zip file whose contents will be extracted and included in the archive As with directories include and exclude patterns may be used to specify a subset of the zip file for inclusion in the archive 147 6 59 4 Examples 6 59 4 Examples lt zip zipfile dist manual zip basedir htdocs manual gt zips all files in the htdocs manual directory into a file called manual zip in the dist direc tory lt zip zipfile dist manual zip basedir htdocs manual update true gt zips all files in the htdocs manual directory into a file called manual zip in the
3. gt This will checkout all files from the Dev folder and below that do not end in bak or old The force flag will cause any existing files to be overwritten by the version in StarTeam lt starteam servername STARTEAM serverport 49201 projectname AProject viewname AView username auser password secret target folder C dev buildtest co includes htm html xcludes index gt This is an example of overlapping includes and excludes attributes Because excludes takes precedence over includes files named index html will not be checked out by this command 255 7 32 Stylebook 7 32 Stylebook 7 32 1 Description This executes the apache Stylebook documentation generator Unlike the commandline version of this tool all three arguments are required to run stylebook Note This task depends on external libraries not included in the Ant distribution See Library Dependen p 5 for more information 7 32 2 Parameters Description the book xml file that the documentation generation starts from the directory that contains the stylebook skin targetdirectory the destination directory where the documentation is generated The user can also specify the nested lt classpath gt element which defines classpath in which the task is executed 7 32 3 Examples lt stylebook targetdirectory build docs book srce xdocs book xm1 skindirectory src skins myskin g
4. The value to set the property to Defaults to true 6 8 3 Parameters specified as nested elements All conditions to test are specified as nested elements 6 8 3 1 not The lt not gt element expects exactly one other condition to be nested into this element negating the result of the condition It doesn t have any attributes and accepts all nested elements of the condition task as nested elements as well 6 8 3 2 and The lt and gt element doesn t have any attributes and accepts an arbitrary number of conditions as nested elements all nested elements of the condition task are supported This condition is true if all of its contained conditions are conditions will be evaluated in the order they have been specified in the build file The lt and gt condition has the same shortcut semantics as the Java amp amp operator as soon as one of the nested conditions is false no other condition will be evaluated 6 8 3 3 or The lt or gt element doesn t have any attributes and accepts an arbitrary number of conditions as nested elements all nested elements of the condition task are supported This condition is true if at least one of its contained conditions is conditions will be evaluated in the order they have been specified in the build file 49 6 8 4 Examples The lt or gt condition has the same shortcut semantics as the Java Il operator as soon as one of the nested conditions is true no other con
5. 39 6 4 AntStructure 6 4 AntStructure 6 4 1 Description Generates a DTD for Ant buildfiles which contains information about all tasks currently known to Ant Note that the DTD generated by this task is incomplete you can always add XML entities using p 132 See http www sdv fr pages casa html ant dtd en html for a way to get around this problem This task doesn t know about required attributes all will be listed as IMPLIED 6 4 2 Parameters Attribute Description Required output file to write the DTD to Yes 6 4 3 Examples lt antstructure output project dtd gt 40 Ant User Manual 6 5 Apply ExecOn 6 5 Apply ExecOn The name execon is deprecated and only kept for backwards compatibilty 6 5 1 Description Executes a system command When the os attribute is specified then the command is only executed when Ant is run on one of the specified operating systems The files and or directories of a number of p 25 s are passed as arguments to the system command If you specify a nested p 28 and the destdir attribute the timestamp of each source file is compared to the timestamp of a target file which is defined by the nested mapper element and searched for in the given destdir At least one fileset is required you must not specify more than one mapper 6 5 2 Parameters 41 6 5 3 Parameters specified as nested elements Description Required the command to e
6. the directory from which to zip the files Determines how long files gt 100 chars are to be handled Allowable values wow are truncate fail warn omil and gnu Default is warn comma separated list of patterns of files that must be included All files are included when omitted the name of a file Each line of this file is taken to be an include pattern comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted excludesfile the name of a file Each line of this file is taken to be an exclude pattern defaultexcludes indicates whether default excludes should be used or not yes no Default excludes are used when omitted 6 48 3 Nested Elements The tar task supports nested tarfileset p 25 elements These are extended Filesets which in addition to the standard fileset elements support three additional attributes Description An 3 digit octal string specify the user group and other modes in the standard Unix fashion The username for the tar entry This is not the same as the UID which is not currently set by the tar task The groupname for the tar entry This is not the same as the GID which is not currently set by the tar task 6 48 4 Examples lt tar tarfile dist manual tar basedir htdocs manual gt lt gzip zipfile dist manual tar gz src dist manual
7. Suppress warning messages Preserve the modification time Keeps a copy of the file with a keep extension Allows the file to be checked in even if it is identical to the original 7 4 1 3 Examples lt cccheckin viewpath c views viewdir afile comment file acomment txt gt nowarn true identical true Does a ClearCase checkin on the file c views viewdir afile Comment text from the file acomment txt is added to ClearCase as a comment All warning messages are suppressed The file is checked in even if it is identical to the original 7 4 2 CCCheckout 159 7 4 3 CCUnCheckout 7 4 2 1 Description Task to perform a Checkout command to ClearCase 7 4 2 2 Parameters Attribute Values Path to the ClearCase view file or directory that the command will operate on Specifies whether to check out the file as reserved or not Creates a writable file under a different filename Checks out the file but does not create an editable file containing its data Specify a branch to check out the file to Allows checkout of a version other than main latest Suppress warning messages Specify a comment Only one of comment or commentfile may be used Specify a file containing a comment Only one of comment or commentfile may be used 7 4 2 3 Examples lt cccheckout viewpath c views viewdir afile reserved true branch abranch nowarn tr
8. 7 15 3 2 Nested Elements 209 Yes 7 15 3 JPCoverage 7 15 3 2 1 classpath jpcoverage supports a nested lt classpath gt element that represents aJ PATH like structurej p 13 7 15 3 2 2 jvmarg Additional parameters may be passed to the VM via nested lt j vmarg gt attributes for example lt jpcoverage home c jprobe classname MyClass gt lt jvmarg value classic gt lt classpath path gt lt jpcoverage gt would run the coverage on MyClass in classic mode VM lt jvmarg gt allows all attributes described in p 14 7 15 3 2 3 arg Parameters may be passed to the executed class via nested lt arg gt attributes as described in ine arguments p 141 7 15 3 2 4 socket Define a host and port to connect to if you want to do remote viewing Description Required the host name ip of the machine on which the Viewer is running No default to localhost The port number on which you will connect to the Viewer No default to 4444 7 15 3 2 5 filters Defines class method filters based on pattern matching The syntax is filters is similar to affileset p 25 Attribute Description Required defaultexclude As a default the coverage exclude all classes and methods Default filters are equivalent to No default to true lt filters gt lt exclude class method gt As seen above nested elements are include and exclude with a name attribute 2
9. Gets a file from a URL GUnzip p 78 Expands a GZip file GZip p 791 GZips a file Par p 80 Jars a set of files aval p 83 Executes a Java class within the running Ant VM or forks another VM if speci fied Favae p 851 Compiles a source tree within the running Ant VM Javadoc Javadoc2 p 90 Generates code documentation using the javadoc tool The Javadoc2 task is deprecated Use the Javadoc task instead Maillip 97 A task to send SMTP email Mkdir p 98 Creates a directory Also non existent parent directories are created when neces sary Move ip 99 Moves a file to a new file or directory or sets of files to a new directory Parallel p 101 Parallel is a container task it can contain other Ant tasks Each nested task within the parallel task will be executed in its own thread PPatehl p 103 Applies a diff file to originals 34 Ant User Manual p 104 6 1 Overview of Ant core tasks Converts a nested path path reference or fileset reference to the form usable on a specified platform and stores the result in a given property Properg ip 1071 Sets a property by name and value or set of properties from file or resource in the project Record ip 110 A recorder is a listener to the current build process that records the output to a file Renamd tp 1121 This task has been deprecated Use t
10. In the case where duplicate entries and or files are found among the files to be merged or added jlink merges or adds the first entry and ignores all subsequent entries jlink ignores META INF directories in mergefiles Users should supply their own manifest information for the output file It is possible to refine the set of files that are being jlinked This can be done with the includes includes file excludes excludesfile and defaultexcludes attributes on the addfiles and mergefiles nested elements With the includes or includesfile attribute you specify the files you want to have included by using patterns The exclude or excludesfile attribute is used to specify the files you want to have excluded This is also done with patterns And finally with the defaultexcludes attribute you can specify whether you want to use default exclusions or not See the section on directory based tasks p 17 on how the inclu sion exclusion of files works and how to write patterns The patterns are relative to the base directory 7 14 2 Parameters Description Required the path of the output file whether or not the output should be compressed true yes or on result No in compressed output If omitted output will be uncompressed inflated files to be merged into the output if possible At least one of files to be added to the output mergefiles or addfiles 206 Ant User Manual 7 14 3 Examples 7 14 3 E
11. lt apply executable l1s gt lt arg value 1 gt lt fileset dir tmp gt lt pattlernset gt lt exclude name txt gt lt patternset gt lt fileset gt lt fileset refid other files gt lt apply gt invokes 1s 1 adding the absolute filenames of all files below tmp not ending in t xt and all files of the FileSet with id other files to the command line lt apply executable somecommand parallel false gt lt arg value argl gt lt srfile gt lt arg value arg2 gt lt fileset dir tmp gt lt apply gt invokes somecommand argl SOURCEFILENAME arg2 for each file in tmp replacing SOURCE FILENAME with the absolute filename of each file in turn If parallel had been set to true SOURCE FILENAME would be replaced with the absolute filenames of all files separated by spaces 43 6 5 4 Examples lt apply executable cc dest src C parallel false gt lt arg value c gt lt arg value o0 gt lt targetfile gt lt srcfile gt lt fileset dir src C lt mapper type glob lt apply gt includes c gt from c to o gt invokes cc c o TARG LE ETF G SOURC EF LE for each c file that is newer than the corresponding o replacing TARGETFILE with the absolute filename of the o and SOURCEFILE with the absolute name of the c file 44 Ant User Manual
12. lt exclude name ias xml gt lt ejbjar gt This example demonstrates the use of a nested classpath element as well as some of the other optional attributes lt ejbjar srcdir build classesdir descriptordir src gt lt iplanet destdir S assemble ejbjar iashome S ias home debug yes keepgenerated yes gt lt classpath gt lt pathelement path gt lt pathelement path build classpath gt lt classpath gt lt iplanet gt lt include name ejb jar xml gt lt exclude name ias xml gt lt ejbjar gt This example demonstrates the use of basejarname attribute In this case the completed EJB JAR will be named HelloWorld jar If multiple EJB descriptors might be found care must be taken to ensure that the completed JAR files don t overwrite each other lt ejbjar srcdir build classesdir descriptordir src basejarname HelloWorld gt lt iplanet destdir S assemble ejbjar classpath ias ejbc cpath gt lt include name ejb jar xml gt lt exclude name ias xml gt lt ejbjar gt This example demonstrates the use of the dtd nested element If the local copies of the DTDs are included in the classpath they will be automatically referenced without the nested elements In iAS 6 0 SP2 these local DTDs are found in the iAS install directory APPS directory In iAS 6 0 SP3 these local DTDs are found in the iAS
13. P4USER myp4userid export P4USER Using build properties lt property name p4 client value nightlybuild gt Using task attributes lt p4Whatever port myserver 1666 client smoketest user smoketestdude fe For more information regarding the underlying p4 commands you are referred to the Perforce Command Reference available from the http www perforce com 235 7 24 4 Task Descriptions 7 24 3 3 Taskdefs Standard taskdefs for you to copy n paste lt taskdef name p4sync classname org apache tools ant taskdefs optional perforce P4Sync gt lt taskdef name p4change classname org apache tools ant taskdefs optional perforce P4Change gt lt taskdef name p4edit classname org apache tools ant taskdefs optional perforce P4Edit gt lt taskdef name p4submit classname org apache tools ant taskdefs optional perforce P4Submit gt lt taskdef name p4have classname org apache tools ant taskdefs optional perforce P4Have gt lt taskdef name p4label classname org apache tools ant taskdefs optional perforce P4Label gt lt taskdef name p4counter classname org apache tools ant taskdefs optional perforce P4Counter gt lt taskdef name p4reopen classname org apache tools ant taskdefs optional perforce P4Reopen gt lt taskdef name p4revert classname org apache tools ant taskdefs optional perforce P4Revert gt 7 24 4 Task Descriptions 7 24 5 P4Sync 7
14. descriptordir descriptor dir basejarname Address gt lt weblogictoplink destdir S solant ejb dir classpath java class path keepgeneric false toplinkdescriptor Address xml toplinkdtd file dtdfiles toplink cmp_2_5_1 dtd suffix jar gt lt include name ejb jar xml gt lt exclude name weblogic ejb jar xml gt lt ejbjar gt This final example shows how you would set up ejbjar under Weblogic 6 0 It also shows the use of the lt support gt element to add support files lt ejbjar descriptordir dd dir srcdir S build classes server gt lt include name ejb jar xml gt lt exclude name weblogic ejb jar xml gt lt support dir build classes server gt lt include name class gt lt support gt lt weblogic destdir deployment dir keepgeneric true suffix jar rebuild false gt lt classpath gt lt pathelement path build classes server gt lt classpath gt lt wlclasspath gt 182 Ant User Manual 7 7 9 ejbjar lt pathelement path weblogic classes gt lt wilclasspath gt lt weblogic gt lt ejbjar gt 7 7 9 9 iPlanet Application Server iAS element The lt iplanet gt nested element is used to build 1AS specific stubs and skeletons and construct a JAR file which may be deployed to the iPlanet Application Server 6 0 The build process will always determine if the EJB stubs skeletons and the
15. dist direc tory If manual zip doesn t exist it is created otherwise it is updated with the new changed files lt zip zipfile dist manual zip basedir htdocs manual excludes mydocs todo html gt zips all files in the htdocs manual directory Files in the directory mydocs or files with the name todo html are excluded lt zip zipfile dist manual zip basedir htdocs manual includes api html excludes todo html gt zips all files in the htdocs manual directory Only html files under the directory api are zipped and files with the name todo htm1 are excluded lt zip zipfile dist manual zip gt lt fileset dir htdocs manual gt lt fileset dir includes ChangeLog txt gt lt zip gt zips all files in the htdocs manual directory and also adds the file ChangeLog txt in the current directory ChangeLog txt will be added to the top of the ZIP file just as if it had been located at htdocs manual ChangeLog txt lt zip zipfile dist manual zip gt lt zipfileset dir htdocs manual prefix docs user guide gt lt zipfileset dir includes ChangeLog27 txt fullpath docs ChangeLog txt gt lt zipfileset src examples zip includes html prefix docs examples gt lt zip gt zips all files in the htdocs manual directory into the docs user guide directory in the archive adds the file ChangeLog27 txt in the current directory as docs ChangeLog tx
16. srce eol crlf includes bat gt Replaces all EOLs with cr lf pairs in the batch files Tabs and spaces are left as is EOF characters are left alone if run on DOS systems and are removed if run on Unix systems 74 Ant User Manual 6 23 3 Examples lt fixcrlf srcdir srce tabs add includes Makefile gt Sets EOLs according to local OS conventions and converts sequences of spaces and tabs to the minimal set of spaces and tabs which will maintain spacing within the line Tabs are set at 8 character intervals EOF characters are left alone if run on DOS systems and are removed if run on Unix systems Many versions of make require tabs prior to commands lt fixcrlf sredir src tabs remove tablength 3 eol 1f javafiles yes includes java gt Converts all EOLs in the included java source files to a single LF Replace all TAB characters except those in string or character constants with spaces assuming a tab width of 3 If run on a unix system any CTRL Z EOF characters at the end of the file are removed On DOS Windows any such EOF characters will be left untouched lt fixcrlf srcdir srce tabs remove includes README gt Sets EOLs according to local OS conventions and converts all tabs to spaces assuming a tab width of 8 EOF characters are left alone if run on DOS systems and are removed if run on Unix systems You never know what editor a us
17. 6 11 Copyfile 6 11 1 Deprecated This task has been deprecated Use the Copy task instead 6 11 2 Description Copies a file from the source to the destination The file is only copied if the source file is newer than the destination file or when the destination file does not exist 6 11 3 Parameters Description the filename of the file to copy the filename of the file where to copy to indicates whether token filtering should take place during the copy forceoverwrite overwrite existing files even if the destination files are newer default is false 6 11 4 Examples lt copyfile src test java dest subdir test java gt lt copyfile src S src index html dest S dist help index html gt 56 Ant User Manual 6 12 Cvs 6 12 Cvs 6 12 1 Description Handles packages modules retrieved from a http www cvshome org repository When doing automated builds the p 77 should be preferred over the checkout command because of speed 6 12 2 Parameters Description Required the CVS command to execute No default checkout the CVSROOT variable No the directory where the checked out files should be No default is project s basedir placed the package module to check out the tag of the package module to check out Use the most recent revision no later than the given date suppress informational messages No default false report only
18. 7 24 9 1 Description List handy file info reflecting the current client contents 7 24 9 2 Parameters Attribute Description Required None 7 24 9 3 Examples lt p4have gt 7 24 10 P4Label 7 24 10 1 Description Create a new label and set contents to reflect current client file revisions 7 24 10 2 Parameters Description The name of the label client view to use for label Label Description Lock the label once created 7 24 10 3 Examples lt p4label name NightlyBuild DSTAMP TSTAMP desc Auto Nightly Build lock locked 7 24 11 P4Counter 7 24 11 1 Description Obtain or set the value of a counter When used in its base form where only the counter name is provided the counter value will be printed to the output stream When the value is provided the counter will be set to the value provided When a property name is provided the property will be filled with the value of the counter You may not specify to both get and set the value of the counter in the same Task 238 Ant User Manual 7 24 12 P4Reopen The user performing this task must have Perforce review permissions as defined by Perforce protections in order for this task to succeed 7 24 11 2 Parameters Description The name of the counter The new value for the counter The property to be set with the value of the counter 7 24 11 3 Examples Print the value of the counter
19. Ant User Manual 5 11 Mapping File Names Examples lt mapper type regexp from java to 1 java bak gt Source file name Target file name A java A java bak foo bar B java foo bar B java bak C properties ignored Classes dir dir2 A properties ignored lt mapper type regexp from 7 to 1 2 2 3 gt Source file name Target file name A java ignored foo bar B java foo bar bar B java C properties ignored Classes dir dir2 A properties Classes dir dir2 dir2 A properties lt mapper type regexp from SS to 2 1 gt Source file name Target file name A java java A foo bar B java java foo bar C properties properties C Classes dir dir2 A properties properties Classes dir dir2 A 31 5 12 Common Attributes of all Tasks 5 12 Common Attributes of all Tasks All tasks share the following attributes Description Unique identifier for this task instance can be used to reference this task in scripts A different name for this task instance will show up in the logging output Room for your comments 399 Ant User Manual 6 Core Tasks 6 Core Tasks 6 1 Overview of Ant core tasks Given the large number of tasks available to a build designer it may be difficult to get an overall view of what each task can do The following table provides a
20. Defines the location of the ejb jar DTD in the weblogic class hierarchy This should not be necessary if you have weblogic in your class path If you do not you should use a nested lt dtd gt element described above generateclient If true turn on the generation of the corresponding ejbjar default false 7 7 11 3 Examples The following build xml snippet is an example of how to use Borland element into the ejbjar task lt ejbjar srcdir build classes basejarname vsmp descriptordir rsc dir hrmanager gt lt borland destdir lib verify on generateclient on gt lt classpath refid classpath gt lt borland gt lt include name ejb jar xml gt lt support dir S build classes gt lt include name demo class gt lt include name demo helper class gt lt support gt lt ejbjar gt 187 7 7 11 BorlandDeployTool The borland element will generate into the lib dir an ejb jar file using the deployment descriptor placed into the rsc dir hrmanager directory The verify phase is turned on and the generate client phase as well 7 7 11 4 188 Ant User Manual 7 8 FTP 7 8 FTP 7 8 1 Description The ftp task implements a basic FTP client that can send receive list delete files and create directories See below for descriptions and examples of how to perform each task Note This task depends on external libraries not included in the Ant distribution See Library Depe
21. Each nested task within the parallel task will be executed in its own thread Parallel tasks have a number of uses in an Ant build file including Taking advantage of available processing resources to reduce build time Testing servers where the server can be run in one thread and the test harness is run in another thread Care must be taken when using multithreading to ensure the tasks within the threads do not interact For example two javac compile tasks which write classes into the same destination directory may interact where one tries to read a class for dependency information while the other task is writing the class file Be sure to avoid these types of interactions within a lt parallel gt task The parallel task has no attributes and does not support any nested elements apart from Ant tasks Any valid Ant task may be embedded within a parallel task including other parallel tasks Note that while the tasks within the parallel task are being run the main thread will be blocked waiting for all the child threads to complete If any of the tasks within the lt parallel gt task fails the remaining tasks in other threads will continue to run until all threads have completed In this situation the parallel task will also fail The parallel task may be combined with the p 119 task to define sequences of tasks to be executed on each thread within the parallel block 6 35 2 Examples lt parallel gt lt wlrun gt lt seq
22. The same thing can be accomplished by using the prefix and fullpath attributes of zipfilesets in a Zip or Jar task The extended zipfileset element from the zip task with attributes prefix fullpath and src is available in the Ear task 6 17 2 Parameters Description the ear file to create The deployment descriptor to use META INF application xml the directory from which to jar the files Not only store data but also compress them defaults to true The character encoding to use for filenames inside the archive Defaults to UTFS8 It is not recommended to change this value as the created archive will most likely be unreadable for Java otherwise Store only file entries defaults to false comma separated list of patterns of files that must be included All files are included when omitted includesfile the name of a file Each line of this file is taken to be an include pattern excludes comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted excludesfile the name of a file Each line of this file is taken to be an exclude pattern defaultexcludes indicates whether default excludes should be used or not yes no Default excludes are used when omitted the manifest file to use indicates whether to update or overwrite the destination file if it already exists Behavior to use if no files matc
23. c myws myprj2 apache tool2 java lt C mypvcs archives myprj2 apache tool2 java arc pvcs rev 1 2 BUILD SUCCESSFUL Total time 22 seconds 247 7 27 RenameExtensions 7 27 RenameExtensions 7 27 1 Deprecated This task has been deprecated Use the movel p 99 task with alglob mapper p 29 instead 7 27 2 Description Renames files in the srcDir directory ending with the fromExtension string so that they end with the toExtension string Files are only replaced if replace is true See the section on directory based tasks p 17 on how the inclusion exclusion of files works and how to write patterns This task forms an implicit p 25 and supports all attributes of lt fileset gt dir becomes srcDir as well as the nested lt include gt lt exclude gt and lt patternset gt elements 7 27 3 Parameters Attribute Description defaultexcludes indicates whether default excludes should be used or not yes no Default excludes are used when omitted excludes comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted excludesfile the name of a file Each line of this file is taken to be an exclude pattern fromExtention The string that files must end in to be renamed comma separated list of patterns of files that must be included All files are included when omitted the name of a file Each line of this file is ta
24. don t change any files No default false the file to direct standard output from the No default output to ANT Log as command MSG_INFO the file to direct standard error from the command No default error to ANT Log as MSG_WARN Port used by CVS to communicate with the server No default port 2401 Password file to read passwords from No default file cvspass 6 12 3 Examples lt cvs cvsRoot pserver anoncvs jakarta apache org home cvspublic package Jjakarta tools dest S ws dir gt checks out the package module jakarta tools from the CVS repository pointed to by the cvsRoot attribute and stores the files in ws dir lt cvs dest ws dir command update gt 57 6 12 3 Examples updates the package module that has previously been checked out into ws dir lt cvs command q diff u N output patch txt gt silently q creates a file called patch txt which contains a unified u diff which includes new files added via cvs add N and can be used as input to patch lt cvs command update A d gt Updates from the head of repository ignoring sticky bits A and creating any new directories as neces sary d Note the text of the command is passed to cvs as is so any cvs options should appear before the command and any command options should appear after the command as in the diff example above See cE a ede ig unre AA for details specifical
25. included when omitted the name of a file Each line of this file is taken to be an include pattern Whether the generated java code is produced Sets whether the generated java source file should be kept after compilation The generated files will have an extension of java keep not java Whether the compiler text logo is displayed when compiling Whether the generated java file should be replaced when compiling Whether the compiler messages will be written to NetRexxC log as well as to the console Tells the NetRexx compiler to store the class files in the same directory as the source files The alternative is the working directory Set the source dir to find the source NetRexx files Tells the NetRexx compiler that method calls always need parentheses even if no arguments are needed e g aStringVar getBytes vs aString Var getBytes Tells the NetRexx compile that assignments must match exactly on type Specifies whether the NetRexx compiler should be case sensitive or not Whether classes need to be imported explicitly using an import statement By default the NetRexx compiler will import certain packages automatically Whether local properties need to be qualified explicitly using this Whether the compiler should force catching of exceptions by explicitly named types Whether debug symbols should be generated into the class file Asks the NetRexx compiler to print co
26. unix gt lt not gt lt and gt lt condition gt sets the property isMacOsButNotMacOsx if the current operating system is MacOS but not MacOS X which Ant considers to be in the Unix family as well 51 6 9 Copy 6 9 Copy 6 9 1 Description Copies a file or Fileset to a new file or directory Files are only copied if the source file is newer than the destination file or when the destination file does not exist However you can explicitly overwrite files with the overwrite attribute p 25 s are used to select files to copy To use a fileset the todir attribute must be set 6 9 2 Parameters Description Required The file to copy One of either file or at least one nested fileset element Give the copied files the same last modified time as No the original files Defaults to no The file to copy to With the file attribute either tofile or todir can be used The directory to copy to With nested filesets only todir is allowed Overwrite existing files even if the destination files No are newer Defaults to no Indicates whether token filtering using the global No build file filters should take place during the copy Defaults to no Nested filtersets will be used even if this value is no Ignore directory structure of source directory copy all files into a single directory specified by the todir attribute Defaults to no Note that you can achieve the same effect b
27. with value2 and all instances of token3 with the value of the property prop erty key as it appears in property file src name properties Note It is possible to use either the token lt replacetoken gt and value lt replacevalue gt attributes elements the nested replacefilter elements or both in the same operation 115 6 42 Rmic 6 42 Rmic 6 42 1 Description Runs the rmic compiler for a certain class Rmic can be run on a single class as specified with the classname attribute or a number of classes at once all classes below base that are neither _Stub nor _Skel classes If you want to rmic a single class and this class is a class nested into another class you have to specify the classname in the form Outer Inner instead of Outer Inner It is possible to refine the set of files that are being rmiced This can be done with the includes includes file excludes excludesfile and defaultexcludes attributes With the includes or includesfile attribute you specify the files you want to have included by using patterns The exclude or excludesfile attribute is used to specify the files you want to have excluded This is also done with patterns And finally with the defaul texcludes attribute you can specify whether you want to use default exclusions or not See the section on directory based tasks p 17 on how the inclusion exclusion of files works and how to write patterns This task forms an implicit p 25
28. 30 4 Examples lt javac srcdir src destdir build classpath xyz jar debug 0n gt compiles all java files under the src directory and stores the class files in the build directory The classpath used contains xyz jar and debug information is on 87 6 30 5 Jikes Notes lt javac srcdir S src destdir build includes mypackage p1 mypackage p2 excludes mypackage pl testpackage classpath xyz jar debug on gt compiles java files under the src directory and stores the class files in the build direc tory The classpath used contains xyz jar and debug information is on Only files under mypack age pl and mypackage p2 are used Files in the mypackage pl testpackage directory are excluded from compilation lt javac srcdir S srce src2 destdir build includes mypackage p1 mypackage p2 excludes mypackage pl testpackage classpath xyz jar debug on gt 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 lt src gt elements as follows lt javac destdir build classpath xyz jar debug on gt lt srce path src gt lt srce path src2 gt lt include name mypackage pl gt lt include name mypackage p2 gt lt exclude name mypackage pl testpackage gt lt javac gt Note If you are using Ant on Wi
29. For each EJB specified the task will locate the three classes that comprise the EJB in the destination direc tory If these class files cannot be located in the destination directory the task will fail The task will also attempt to locate the EJB stubs and skeletons in this directory If found the timestamps on the stubs and skeletons will be checked to ensure they are up to date Only if these files cannot be found or if they are out of date will the iAS ejbc utility be called to generate new stubs and skeletons 7 7 6 2 Parameters Description Standard EJB 1 1 XML descriptor typically titled ejb jar xml iAS specific EJB XML descriptor typically titled ias ejb jar xml The is the base directory where the RMI stubs and skeletons are written In addition the class files for each bean home interface remote interface and EJB implementation must be found in this directory The classpath used when generating EJB stubs and skeletons If omitted the classpath specified when Ant was started will be used Nested classpath elements may also be used Indicates whether or not the Java source files which are generated by ejbc will be saved or automatically deleted If yes the source files will be retained If omitted it defaults to no Indicates whether or not the ejbc utility should log additional debugging state ments to the standard output If yes the additional debugging statements will be generated I
30. It is invoked similar to the jar p 80 or zip p 146 tasks This task will work on Windows using the external cabarc tool provided by Microsoft which must be located in your executable path See the section on directory based tasks p 17 on how the inclusion exclusion of files works and how to write patterns This task forms an implicit p 25 and supports all attributes of lt fileset gt dir becomes basedir as well as the nested lt include gt lt exclude gt and lt patternset gt elements 7 3 2 Parameters Description the name of the cab file to create the directory to start archiving files from set to yes if you want to see the output from the cabarc tool defaults to no set to no to store files without compressing defaults to yes use to set additional command line options for the cabarc tool should not normally be necessary comma separated list of patterns of files that must be included All files are included when omitted includesfile the name of a file Each line of this file is taken to be an include pattern excludes comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted excludesfile the name of a file Each line of this file is taken to be an exclude pattern defaultexcludes indicates whether default excludes should be used or not yes no Default excludes are
31. Sql 6 46 Sql 6 46 1 Description Executes a series of SQL statements via JDBC to a database Statements can either be read in from a text file using the src attribute or from between the enclosing SQL tags Multiple statements can be provided separated by semicolons or the defined delimiter Individual lines within the statements can be commented using either or REM at the start of the line The autocommit attribute specifies whether auto commit should be turned on or off whilst executing the statements If auto commit is turned on each statement will be executed and committed If it is turned off the statements will all be executed as one transaction The onerror attribute specifies how to proceed when an error occurs during the execution of one of the statements The possible values are continue execution only show the error stop execution and commit transaction and abort execution and transaction and fail task 6 46 2 Parameters Description Required Class name of the jdbc driver Yes Database connection url Yes Database user name Yes Database password Yes File containing SQL statements Yes unless statements enclosed within tags delimiter String that separates SQL statements No default autocommit Auto commit flag for database connection default No default false false print Print result sets from the statements default false No default false showheaders Pri
32. URLs by using a space character Group specified packages together in overview page The format is as described etow ip 931 Do not include deprecated information Do not generate deprecated list Do not generate class hierarchy Do not generate index Do not generate help link Do not generate navigation bar FUTURE Generate warning about serial tag FUTURE Specifies the HTML help file to use Specifies the CSS stylesheet to use FUTURE Charset for cross platform viewing of generated documentation Output file encoding name Specifies the class file that starts the doclet used in generating the documentation Specifies the path to the doclet class file that is specified with the doclet option Specifies the path to the doclet class file that is specified with the doclet option by reference p 15 to a PATH defined elsewhere additionalparam Lets you add additional parameters to the javadoc command line Useful for doclets Parameters containing spaces need to be quoted using amp quot Stop the buildprocess if the command exits with a returncode other than 0 92 Ant User Manual 6 31 3 Parameters specified as nested elements excludepackagenames comma separated list of packages you don t want docs for defaultexcludes indicates whether default excludes should be used yes no default excludes are used when
33. Under some operating systems this gives access to facilities not normally available through the VM including under Windows being able to execute scripts rather than their associ ated interpreter 6 5 3 Parameters specified as nested elements 6 5 3 1 fileset You can use any number of nested lt fileset gt elements to define the files for this task and refer to lt fileset gt s defined elsewhere 42 Ant User Manual 6 5 4 Examples 6 5 3 2 arg Command line arguments should be specified as nested lt arg gt elements See p 14 6 5 3 3 srcfile By default the file names of the source files will be added to the end of the command line If you need to place it somewhere different use a nested lt srcfile gt element between your lt arg gt elements to mark the insertion point 6 5 3 4 targetfile lt targetfile gt is similar to lt srcfile gt and marks the position of the target filename on the command line If omitted the target filenames will not be added to the command line at all This element can only be specified if you also define a nested mapper and the destdir attribute 6 5 3 5 env It is possible to specify environment variables to pass to the system command via nested lt env gt elements See the description in the section about exec p 69 Please note that the environment of the current Ant process is not passed to the system command if you specify variables using lt env gt 6 5 4 Examples
34. You also need to specify the directory containing the JavaCC installation using the javacchome attribute so that ant can find the JavaCC classes Optionally you can also set the outputdirectory to write the generated file to a specific directory Otherwise jjtree writes the generated JavaCC grammar file to the directory containing the JJTree grammar file This task only invokes JJTree if the grammar file is newer than the generated JavaCC file 7 13 2 Parameters Description The jjtree grammar file to process The directory containing the JavaCC distribution outputdirectory The directory to write the generated file to If not set the files are written to the directory containing the grammar file buildnodefiles Sets the BUILD_NODE_FILES grammar option This is a boolean option multi Sets the MULTI grammar option This is a boolean option nodedefaultvoid Sets the NODE_DEFAULT_VOID grammar option This is a boolean option nodefactory Sets the NODE_FACTORY grammar option This is boolean option nodescopehook Sets the NODE_SCOPE_HOOK grammar option This is a boolean option nodeusesparser Sets the NODE_USES_PARSER grammar option This is a boolean option Sets the STATIC grammar option This is a boolean option Sets the VISITOR grammar option This is a boolean option Sets the NODE_PACKAGE grammar option This is a string option visitorexception Sets the VISITOR_EXCEPTI
35. and supports all attributes of lt fileset gt dir becomes srcdir as well as the nested lt include gt lt exclude gt and lt patternset gt elements The output file is only written if it is a new file or if it differs from the existing file This prevents spuri ous rebuilds based on unchanged files which have been regenerated by this task 6 23 2 Parameters Description Where to find the files to be fixed up Where to place the corrected files Defaults to srcDir replacing the original file comma separated list of patterns of files that must be included All files are included when omitted the name of a file Each line of this file is taken to be an include pattern comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted the name of a file Each line of this file is taken to be an exclude pattern defaultexcludes indicates whether default excludes should be used or not yes no Default excludes are used when omitted 72 Ant User Manual 6 23 2 Parameters Specifies how end of line EOL characters are to be handled The EOL char acters are CR LF and the pair CRLF Valid values for this property are asis leave EOL characters alone cr convert all EOLs to a single CR If convert all EOLs to a single LF crlf convert all EOLs to the pair CRLF Default is based on the platform on which you are running
36. arguments The name of a file as a single command line argument will be replaced with Exactly one the absolute filename of the file of these A string that will be treated as a path like string as a single command line argu ment you can use or as path separators and Ant will convert it to the plat form s local conventions 14 Ant User Manual 4 1 10 References 4 1 9 1 Examples lt arg value 1 a gt is a single command line argument containing a space character lt arg line 1 a gt represents two separate command line arguments lt arg path dir dir2 dir3 gt is a single command line argument with the value dir dir2 dir3 on DOS based systems and dir dir2 dir3 on Unix like systems 4 1 10 References The id attribute of the buildfile s elements can be used to refer to them This can useful if you are going to replicate the same snippet of XML over and over again using a lt classpath gt structure more than once for example The following example lt project gt lt starget aen gt lt rmic gt lt classpath gt lt pathelement location lib gt lt pathelement path java class path gt lt pathelement path additional path gt lt classpath gt lt rmic gt lt target gt lt target sie gt lt javac gt lt classpath gt lt pathelement location lib gt lt pathelement path java class path gt lt pat
37. build classes 118 Ant User Manual 6 43 Sequential 6 43 Sequential 6 43 1 Description Sequential is a container task it can contain other Ant tasks The nested tasks are simply executed in sequence Sequential s primary use is to support the sequential execution of a subset of tasks within the p 101 task The sequential task has no attributes and does not support any nested elements apart from Ant tasks Any valid Ant task may be embedded within the sequential task 6 43 2 Example lt parallel gt lt wlrun gt lt sequential gt lt sleep seconds 30 gt SJUNLE 1255 lt wlstop gt lt sequential gt lt parallel gt This example shows how the sequential task is used to execute three tasks in sequence while another task is being executed in a separate thread 119 6 44 SignJar 6 44 SignJar 6 44 1 Description Signs a jar or zip file with the javasign command line tool 6 44 2 Parameters Description the jar file to sign the alias to sign under password for keystore integrity keystore location keystore type password for private key if different name of SF DSA file name of signed JAR file true false verbose output when signing true false include the SF file inside the signature block true false don t compute hash of entire manifest 6 44 3 Examples lt signjar jar dist lib ant jar alias ap
38. developing software across multi ple platforms Make like tools are inherently shell based they evaluate a set of dependencies then execute commands not unlike what you would issue on a shell This means that you can easily extend these tools by using or writing any program for the OS that you are working on however this also means that you limit yourself to the OS or at least the OS type such as Unix that you are working on Makefiles are inherently evil as well Anybody who has worked on them for any time has run into the dreaded tab problem Is my command not executing because I have a space in front of my tab said the original author of Ant way too many times Tools like Jam took care of this to a great degree but still have yet another format to use and remember Ant is different Instead of a model where it is extended with shell based commands Ant is extended using Java classes Instead of writing shell commands the configuration files are XML based calling out a target tree where various tasks get executed Each task is run by an object that implements a particular Task interface Granted this removes some of the expressive power that is inherent in being able to construct a shell command such as find name foo exec rm but it gives you the ability to be cross platform to work anywhere and everywhere And hey if you really need to execute a shell command Ant has an lt exec gt task that allows different commands
39. excluded This is also done with patterns And finally with the defaul texcludes attribute you can specify whether you want to use default exclusions or not See the section on directory based tasks p 17 on how the inclusion exclusion of files works and how to write patterns This task forms an implicit p 25 and supports all attributes of lt fileset gt dir becomes basedir as well as the nested lt include gt lt exclude gt and lt patternset gt elements Style supports the use of a lt param gt element which is used to pass values to an lt xsl param gt declaration If you want to use Xalan J 1 or XSL P you also need Ant s optional jar 6 47 2 Parameters 126 Ant User Manual 6 47 3 Parameters specified as nested elements Description Required where to find the source XML file default is the project s basedir No directory in which to store the results Yes unless in and out have been speci fied desired file extension to be used for the targets If not specified the default is html name of the stylesheet to use given either relative to the project s basedir or as an absolute path DEPRECATED can be specified as a path relative to the basedir attribute of this task as well the classpath to use when looking up the XSLT processor the classpath to use given as reference p 15 to a path defined elsewhere Recreate target files even if they are newer than
40. file components Saving modified build file Current development tasks include A more complete set of target and task editing capabilities A wizard for creating basic build files including importing existing code bases Better build progress monitoring The Antidote source distribution comes with requirements and design documentation that better cover the details of application architecture how to develop against it and what the long term goals are Further more there is a TODO file listing the detailed near term tasks that need accomplishing 8 1 3 Getting Involved The source code for Antidote is located in a separate Module http cvs apache org viewcvs jakarta ant antidote in CVS All the existing documentation can be found there where new contributors should read e http cvs apache org viewcvs checkout jakarta ant antidote docs devel oper design design overview html o Feature List http cvs apache org viewcvs checkout jakarta ant antidote docs devel 263 8 1 3 Getting Involved oper design gui requirements html Idea Refinement http cvs apache org viewcvs checkout jakarta ant antidote docs devel oper design gui ideas txt New Module HOWTO http cvs apache org viewcvs checkout jakarta ant antidote docs devel oper design new module howto html Static Class Diagrams http cvs apache org viewcvs checkout jakarta ant antidote docs devel oper design uml index h
41. file has the same affect as a cvs login command Delete p 60 Deletes either a single file all files in a specified directory and its sub directories or a set of files specified by one or more p 25 s Deltree p 62 This task has been deprecated Use the Delete task instead 33 6 1 Overview of Ant core tasks Dependsei ip 63 The dependset task compares a set of source files with a set of target files If any of the source files is more recent than any of the target files all of the target files are removed Ear p 65 An extension of the Jar p 80 task with special treatment for files that should end up in an Enterprise Application archive Echolip 67 Echoes a message to System out or a file Exec p 68 Executes a system command When the os attribute is specified then the command is only executed when Ant is run on one of the specified operating systems Fail p 70 Exits the current build Just throwing a BuildException optionally printing addi tional information Eep 711 Sets a token filter for this project or read multiple token filter from an input file and sets these as filters Token filters are used by all tasks that perform file copying operations through the Project commodity methods FixCRLF p 72 Modifies a file to add or remove tabs carriage returns linefeeds and EOF charac ters p 76 Generates a key in keystore Get p 77
42. file into Ant s lib directory You will also need the Perforce client executable p4 or p4 exe but not p4win exe in your path 7 24 3 The Tasks p 236 Synchronise a workspace to a depot P4Change p 236 Request a new changelist from the Perforce server p 237 Open files for edit checkout p 237 Submit a changelist to the Perforce server checkin p 237 List current files in client view useful for reporting p 238 Create a label reflecting files in the current workspace p 238 Obtain or set the value of a counter P4Reopen p 239 Move files between changelists p 240 Revert files 234 Ant User Manual 7 24 3 The Tasks 7 24 3 1 General P4 Properties Each p4 task requires a number of settings either through build wide properties individual attributes or environment variables These are Attribute Env Var Description Default port P4PORT The p4d server and port to connect to perforce 1666 client P4CLIENT The p4 client spec to use The logged in username P4USER The p4 username The logged in username The client branch or label view to operate upon See the p4 user guide for more info Your local installation of Perforce may require other settings e g PHPASSWD P4CONFIG At the moment these can only be set outside of Ant as environment variables 7 24 3 2 Examples Setting in the environment Unix csh setenv P4PORT myperforcebox 1666 Unix sh et al
43. file to rename new name of the file Enable replacing of existing file default on 6 40 4 Examples lt rename src foo jar dest name S version jar gt Renames the file foo jar to name S version jar assuming name and version being predefined properties If a file named name version jar already exists it will be removed prior to renaming foo jar 112 Ant User Manual 6 41 Replace 6 41 Replace 6 41 1 Description Replace is a directory based task for replacing the occurrence of a given string with another string in selected file If you want to replace a text that crosses line boundaries you must use a nested lt replacetoken gt element 6 41 2 Parameters Description Required file for which the token should be replaced The base directory to use when replacing a token in Exactly one of the two multiple files the token which must be replaced Yes unless a nested replace token element is used the new value for the token When omitted an empty No string is used Indicates whether a summary of the replace operation No by default no summary is should be produced detailing how many token occur produced rences and files were processed valid property file from which properties specified Yes only if property attribute of using nested lt replacefilter gt elements are lt replacefilter gt is used drawn comma separated list of pat
44. filesets and sourcefilelist filelists and if any are older they are all deleted 63 6 16 4 Examples 6 16 3 4 targetfilelist The nested target filelist element specifies a p 24 All files included in this filelist will be compared against all files included in all of the srcfileset filesets and sourcefilelist filelists and if any are older they are all deleted 6 16 4 Examples lt dependset gt lt srcfilelist dir S dtd dir files paper dtd common dtd gt lt srcfilelist dir S xsl dir files common xsl gt lt srcfilelist dir S basedir files build xml gt lt targetfileset dir S output dir includes html gt lt dependset gt In this example derived HTML files in the output dir directory will be removed if any are out of date with respect to the DTD of their source XML files a common DTD imported by the main DTD asubordinate XSLT stylesheet imported by the main stylesheet or the buildfile If any of the source files in the above example does not exist all target files will also be removed To ignore missing source files instead use filesets instead of filelists for the source files 64 Ant User Manual 6 17 Ear 6 17 Ear 6 17 1 Description An extension of the p 80 task with special treatment for files that should end up in an Enterprise Application archive The Ear task is a shortcut for specifying the particular layout of a EAR file
45. for T3 connec tions For example t3 localhost 7001 The delay in seconds after which the server will stop This defaults to an immedi ate shutdown 174 Ant User Manual 7 7 9 ejbjar 7 7 8 3 Nested Element The classpath of the welstop task can be set by a lt classpath gt nested element 7 7 8 4 Examples This example show the shutdown for a Weblogic 6 0 server lt wlstop classpath weblogic classes user system url t3 localhost 7001 password foobar beahome bea home gt 7 7 9 ejbjar 7 7 9 1 Description This task is designed to support building of EJB1 1 jar files Support is currently provided for vanilla EJB1 1 jar files i e those containing only the user generated class files and the standard deployment descriptor Nested elements provide support for vendor specific deployment tools These currently include Borland Application Server 4 5 iPlanet Application Server 6 0 Jboss 2 1 and above Weblogic 5 1 6 0 session entity beans using the weblogic ejbc tool TOPLink for WebLogic 2 5 1 enabled entity beans This task supports two approaches to creating ejb jar files The first approach assumes a particular naming convention for deployment descriptor files For an Account bean for example the deployment descriptor would be named Account ejb jar xml This naming convention allows the task to distinguish deployment descriptors without relying on their positioning within a sour
46. from the file some file one pattern per line lt patternset gt lt includesfile name some file gt lt includesfile name some other file if some other file gt lt patternset gt will also read include patterns from the file the property some other file points to if a property of that name has been defined 23 5 5 FileList 5 5 FileList FileLists are explicitly named lists of files Whereas FileSets act as filters returning only those files that exist in the file system and match specified patterns filelists are useful for specifying filenames that may or may not exist Multiple files are specified via a comma separated list with no support for wildcards FileLists can appear inside tasks that support this feature or at the same level as target i e as children of project Description the base directory of this FileList Comma separated list of file names 5 5 0 1 Examples lt filelist id docfiles dir S doc src files foo xml bar xml gt The files doc src foo xml and doc src bar xml Note that these files may not yet actually exist lt filelist refid docfiles gt Same files as the example above 24 Ant User Manual 5 6 FileSet 5 6 FileSet FileSets are groups of files These files can be found in a directory tree starting in a base directory and are matched by patterns taken from a number of p 22 FileSets can appear inside
47. good practice to place your p 134 tasks in a so called initialization target on which all other targets depend Make sure that target is always the first one in the depends list of the other targets In this manual most initialization targets have the name init A target has the following attributes Description the name of the target a comma separated list of names of targets on which this target depends the name of the property that must be set in order for this target to execute the name of the property that must not be set in order for this target to execute a short description of this target s function 4 1 3 Tasks A task is a piece of code that can be executed A task can have multiple attributes or arguments if you prefer The value of an attribute might contain references to a property These references will be resolved before the task is executed 10 Ant User Manual 4 1 4 Properties Tasks have a common structure lt name attributel valuel attribute2 Vvalue2 gt where name is the name of the task attributeN is the attribute name and valueN is the value for this attribute There is a set of p 17 along with a number of p 150 but it is also very easy tofurite your ownlip 276 All tasks share a task name attribute The value of this attribute will be used in the logging messages generated by Ant Tasks can be assigned an id attribute lt taskname
48. gt lt entry key formated date type date value now pattern DDD HH mm gt lt propertyfile gt To produce dates relative from today 242 Ant User Manual lt propertyfile file my properties comment My properties gt lt entry key formated date 1 type date default now pattern DDD operation value 1 gt lt entry key formated tomorrow type date default now pattern DDD operation value 1 gt lt propertyfile gt Concatenation of strings lt propertyfile file my properties comment My properties gt lt entry key progress default operation value lt propertyfile gt Each time called a will be appended to progress 243 WIS 7 25 3 PropertyFile Task 7 26 Ant Pvcs Task User Manual 7 26 Ant Pvcs Task User Manual by Thomas Christensen tchristensen nordija com Don Jeffery donj apogeenet com Version 1 1 2001 06 27 Problems with UNC pathnames and the use of in paths are fixed and an updateonly argument intro duced Version 1 0 2001 01 31 Initial release 7 26 1 Table of Contents Introduction p 244 Pves Task p 244 7 26 2 Introduction The lt pvcs gt task allows the user of ant to extract the latest edition of the source code from a PVCS reposi tory PVCS is a version control system developed by Merant http www merant com products pvcs Before using this tag the use
49. gt lt filter token DATE value DATE gt lt filterset gt lt copy gt 26 Ant User Manual Copy all the docs but change all dates and appropriate notices as stored in a file lt copy toDir S dist home docs gt lt fileset dir S build home docs gt lt include name html gt lt fileset gt lt filterset begintoken endtoken lt filter token DATE value S DATI x gt E gt lt filtersfile file user home dist properties gt lt filterset gt lt copy gt 27 5 10 Filtersfile 5 11 Mapping File Names 5 11 Mapping File Names Some tasks take source files and create target files Depending on the task it may be quite obvious which name a target file will have using javac p 85 you know there will be class files for your java files in other cases you may want to specify the target files either to help Ant or to get an extra bit of functionality While source files are usually specified as p 25 s you don t specify target files directly instead you tell Ant how to find the target file s for one source file An instance of org apache tools ant util FileNameMapper is responsible for this It constructs target file names based on rules that can be parameterized with from and to attributes the exact meaning of which is implementation dependent These instances are defined in lt mapper gt elements with the following attrib
50. id taskID gt where taskname is the name of the task and taskJD is a unique name for this task You can refer to the corresponding task object in scripts or other tasks via this name For example in scripts you could do lt script gt taskl setFoo bar lt script gt to set the foo attribute of this particular task instance In another task written in Java you can access the instance via project getReference task1 Note If task1 has not been run yet then it has not been configured ie no attributes have been set and if it is going to be configured later anything you ve done to the instance may be overwritten Note Future versions of Ant will most likely not be backward compatible with this behaviour since there will likely be no task instances at all only proxies 4 1 4 Properties A project can have a set of properties These might be set in the buildfile by the property task p 107 or might be set outside Ant A property has a name and a value Properties may be used in the value of task attributes This is done by placing the property name between and in the attribute value For example if there is a builddir property with the value build then this could be used in an attribute like this builddir classes This is resolved as build classes 4 1 5 Built in Properties Ant provides access to all system properties as if they had been defined using a lt property gt t
51. in the order they appear from left to right Keep in mind that it is possible that a target can get executed earlier when an earlier target depends on it 4 1 3 Tasks lt target name A gt lt target name B depends A gt lt target name C depends B gt lt target name D depends C B A gt Suppose we want to execute target D From its depends attribute you might think that first target C then B and then A is executed Wrong C depends on B and B depends on A so first A is executed then B then C and finally D A target gets executed only once even when more than one target depends on it see the previous example A target also has the ability to perform its execution if or unless a property has been set This allows for example better control on the building process depending on the state of the system java version OS command line property defines etc To make a target sense this property you should add the if or unless attribute with the name of the property that the target should react to For example lt target name build module A if module A present gt lt target name build own fake module A unless module A present gt If no if and no unless attribute is present the target will always be executed The optional description attribute can be used to provide a one line description of this target which is printed by the projecthelp command line option It is a
52. methods JNI operates differently depending on whether JDK1 2 http java sun com j2se 1 3 docs tooldocs win32 javah html or later or pre JDK1 2 http java sun com products jdk 1 1 docs tooldocs win32 javah html systems are used 7 11 2 Parameters Description the fully qualified name of the class or classes separated by commas concatenates the resulting header or source files for all the classes listed into this file sets the directory where javah saves the header files or the stub files specifies that output files should always be written JDK1 2 only specifies that old JDK1 0 style header files should be generated otherwise output file contain JNI style native method function prototypes JDK1 2 only generate C declarations from the Java object file used with old causes Javah to print a message concerning the status of the generated files the classpath to use bootclasspath location of bootstrap class files extdirs location of installed extensions Either outputFile or destdir must be supplied but not both 7 11 3 Examples lt javah destdir c class org foo bar Wibble gt makes a JNI header of the named class using the JDK1 2 JNI model Assuming the directory c already exists the file org_foo_bar_Wibble h is created there If this file already exists it is left unchanged lt javah outputFile wibble h gt lt class name org foo bar Wibbl
53. of BCC recipients mailhost Host name of the mail server No default to localhost Email subject line No Email address of sender Yes failonerror Stop the build process if an error No default to true occurs sending the e mail 7 20 3 Examples Send a single HTML file as the body of a message lt mimemail messageMimeType text html messageFile overview summary html tolist you subject JUnit Test Results S TODAY from me gt Sends all files in a directory as attachments lt mimemail message See attached files tolist you subject Attachments from me gt lt fileset dir gt lt include name dist gt lt fileset gt lt mimemail gt 227 7 21 MParse 7 21 MParse by Stephane Bailliez sbailliez imediation com 7 21 1 Requirements This task requires Metamata Development environment 2 0 freely available at http www metamata com 7 21 2 Description Invokes the Metamata http www metamata com parse html compiler compiler on a grammar file To use the mparse task set the target attribute to the name of the grammar file to process You also need to specify the directory containing the Metamata installation using the metamatahome attribute so that Ant can find the MParse classes This task only invokes MParse if the grammar file is newer than the generated Java files MParse assumes that the Java class name of the generated parser is the
54. or only the filtersfile attribute 6 22 2 Parameters Description the token string without the string that should be put to replace the token when the file is copied The file from which the filters must be read This file must be a formatted as a property file see notes 1 and 2 above parameters table 6 22 3 Examples lt filter token year value 2000 gt lt copy todir dest dir filtering true gt lt fileset dir S sre dir gt lt copy gt will copy recursively all the files from the src dir directory into the dest dir directory replacing all the occurences of the string year with 2000 lt filter filtersfile deploy_env properties gt will read all property entries from the deploy_env properties file and set these as filters 71 6 23 FixCRLF 6 23 FixCRLF 6 23 1 Description Adjusts a text file to local conventions The set of files to be adjusted can be refined with the includes includesfile excludes excludesfile and defaultexcludes attributes Patterns provided through the includes or includesfile attributes specify files to be included Patterns provided through the exclude or excludesfile attribute specify files to be excluded Additionally default exclusions can be specified with the defaultexcludes attribute See the section on directory based tasks p 17 for details of file inclusion exclusion patterns and their usage This task forms an implicit p 25
55. permissions No default is file of plain files are going to be changed If set to dir only the directories are considered 47 6 7 3 Examples 6 7 3 Examples lt chmod file dist start sh perm ugotrx gt makes the start sh file readable and executable for anyone on a UNIX system lt chmod dir dist bin perm ugo trx includes sh gt makes all sh files below dist bin readable and executable for anyone on a UNIX system lt chmod perm gtw gt lt fileset dir shared sources1 gt lt exclude name trial gt lt fileset gt lt fileset refid other shared sources gt lt chmod gt makes all files below shared sourcesl1 except those below any directory named trial writable for members of the same group on a UNIX system In addition all files belonging to a FileSet with id other shared sources get the same permissions 48 Ant User Manual 6 8 Condition 6 8 Condition 6 8 1 Description Sets a property if a certain condition holds true this is a generalization of Available p 45 and p 142 If the condition holds true the property value is set to true by default otherwise the property is not set You can set the value to something other than the default by specifying the value attribute Conditions are specified as nested elements p 49 you must specify exactly one condition 6 8 2 Parameters Description The name of the property to set
56. pvcs PVCS Version Manager VMGUI v6 6 10 Build 870 for Windows NT 80x86 pvcs Copyright 1985 2000 MERANT All rights reserved pvcs PVCS Version Manager get v6 6 10 Build 870 for Windows NT 80x86 pvcs Copyright 1985 2000 MERANT All rights reserved pvcs c myws myprj main java lt C mypvcs archives myprj main java arc pvcs rev 1 1 pvcs c myws myprj apache tool java lt C mypvcs archives myprj apache tools java arce pvcs rev 1 5 BUILD SUCCESSFUL Total time 19 seconds This next example extracts the latest version of the files in the pvcs repository from two projects using nested lt pvcsproject gt elements lt lt target name getlatest2 gt lt pvcs repository mnt pvcs gt lt pvesproject name myprj gt lt pvesproject name myprj2 gt lt pvcs gt lt target gt Now run ant getlatest2 This will cause the following output to appear getlatest2 pvcs PVCS Version Manager VMGUI v6 6 10 Build 870 for Windows NT 80x86 pvcs Copyright 1985 2000 MERANT All rights reserved pvcs PVCS Version Manager get v6 6 10 Build 870 for Windows NT 80x86 pvcs Copyright 1985 2000 MERANT All rights reserved pvcs rev 1 1 pvcs c myws myprj main java lt C mypvcs archives myprj main java arc pvcs c myws myprj apache tool java lt C mypvcs archives myprj apache tool java arc 246 Ant User Manual 7 26 3 Pvcs Task pvcs rev 1 5 pvcs
57. set class A would also be removed Normally direct relationships are sufficient it is unusual for a class to depend on another without having a direct relationship With closure set you will notice that depend typically removes far more class files The classpath attribute for lt depend gt is optional If it is present depend will check class dependencies against classes and jars on this classpath Any classes which depend on an element from this classpath and which are older than that element will be deleted A typical example where you would use this facility would be where you are building a utility jar and want to make sure classes which are out of date with respect to this jar are rebuilt You should not include jars in this classpath which you do not expect to change such as the JDK runtime jar or third party jars since doing so will just slow down the dependency check This means that if you do use a classpath for the depend task it may be different from the classpath necessary to actually compile your code 165 7 6 2 Performance 7 6 2 Performance The performance of the depend task is dependent on a number of factors such as class relationship complexity and how many class files are out of date The decision about whether it is cheaper to just recompile all classes or to use the depend task will depend on the size of your project and how interrelated your classes are 7 6 3 Limitations There are some source dependencies whi
58. short description of each task and a link to the complete documentation Task Name Description p 37 Runs Ant on a supplied buildfile This can be used to build subprojects AntCall p 38 Call another target within the same build file optionally specifying some proper ties p 40 Generates a DTD for Ant buildfiles which contains information about all tasks currently known to Ant Apply ExecOn p Executes a system command When the os attribute is specified then the command 41 is only executed when Ant is run on one of the specified operating systems Available p 45 Sets a property if a resource is available at runtime This resource can be a file a directory a class in the classpath or a JVM system resource p 47 Changes the permissions of a file or all files inside specified directories Right now it has effect only under Unix The permissions are also UNIX style like the argument for the chmod command p 49 Sets a property if a certain condition holds true this is a generalization of fbielip 45 and Uprodateip 142 p 52 Copies a file or Fileset to a new file or directory Copydir p 54 This task has been deprecated Use the Copy task instead Copyfile p 56 This task has been deprecated Use the Copy task instead p 57 Handles packages modules retrieved from a http www cvshome org repository CVSPass p 59 Adds entries to a cvspass file Adding entries to this
59. t rue unless controlfile is specified in which case it defaults to false Indicates whether or not to instrument for invariants Defaults to true unless controlfile is specified in which case it defaults to false The full name of the Throwable Exception that should be thrown when an assertion is violated Defaults to java lang Error Indicates the verbosity level of iContract Any combination of error warning note info progress debug comma separated can be used Defaults to error Indicates if iContract should be quiet Turn it off if many your classes extend uninstrumented classes and you don t want warn ings about this Defaults to false If set to true it indicates that the properties file for iControl in the current directory should be updated or created if it doesn t exist Defaults to false The name of the control file to pass to iContract Consider using Only if updateicon iControl to generate the file Default is not to pass a file trol true Indicates where compiled unistrumented classes are located Only if updateicon This is required in order to properly update the icontrol properties trol true file not for instrumentation Name of the file that will be generated by this task which lists all No the classes that iContract will instrument If specified the file will not be deleted after execution If not specified a file will still be created but it will be delete
60. the name of a file Each line of this file is taken to be an include pattern comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted excludesfile the name of a file Each line of this file is taken to be an exclude pattern defaultexcludes indicates whether default excludes should be used or not yes no Default excludes are used when omitted indicates whether token filtering should take place during the copy ignore directory structure of source directory copy all files into a single direc tory specified by the dest attribute default is false forceoverwrite overwrite existing files even if the destination files are newer default is false 54 Ant User Manual 6 10 4 Examples 6 10 4 Examples lt copydir src S src resources dest S dist gt copies the directory src resources to dist lt copydir src S src resources dest dist includes java xcludes Test java gt copies the directory src resources to dist recursively All java files are copied except for files with the name Test java lt copydir src S src resources dest S dist includes java excludes mypackage test gt copies the directory src resources to dist recursively All java files are copied except for the files under the mypackage test directory 55 6 11 Copyfile
61. their corresponding source files or the stylesheet name of the XSLT processor to use Permissible values are trax for a TraX compliant processor xslp for the XSL P processor xalan for the Apache XML Xalan version 1 processor or the name of an arbitrary XSLTLiaison class Defaults to trax followed by xslp then xalan in that order The first one found in your class path is the one that is used DEPRECATED XSL P is deprecated and will be removed in the next version Use trax or xalan instead includes comma separated list of patterns of files that must be included All files are included when omitted includesfile the name of a file Each line of this file is taken to be an include pattern excludes comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted excludesfile the name of a file Each line of this file is taken to be an exclude pattern defaultexcludes indicates whether default excludes should be used or not yes no Default excludes are used when omitted specifies a single XML document to be styled Should be used with the out attribute specifies the output name for the styled result from the in attribute 6 47 3 Parameters specified as nested elements 127 6 47 4 Examples 6 47 3 1 classpath The classpath to load the processor from can be specified via a nested lt classpa
62. this task For Unix platforms the default is If For DOS based systems including Windows the default is crlf For Mac OS the default is cr This is the preferred method for specifying EOL The cr attribute see below is now deprecated N B One special case is recognized The three characters CR CR LF are regarded as a single EOL Unless this property is specified as asis this sequence will be converted into the specified EOL type Deprecated Specifies how CR characters are to be handled at end of line EOL Valid values for this property are asis leave EOL characters alone add add a CR before any single LF characters The intent is to convert all EOLs to the pair CRLF remove remove all CRs from the file The intent is to convert all EOLs to a single LF Default is based on the platform on which you are running this task For Unix platforms the default is remove For DOS based systems including Windows the default is add N B One special case is recognized The three characters CR CR LF are regarded as a single EOL Unless this property is specified as asis this sequence will be converted into the specified EOL type Used only in association with the tab attribute see below this boolean attribute indicates whether the fileset is a set of java source files yes no Defaults to no See notes in section on tab 73 6 23 3 Examples Specifies how tab chara
63. tn g bn ree ue ty oo of 2 ey ET 6 23 be oe bt a ee ode ah AS age Be ole fo a See oe oh 6 24 AP Pore os yw i TEER bota a g So o zo a 16 6 25 fo oa Bo i a 3 w Soo os we y a fy o 4 TTI 6 26 F b s Aye Ba tS Beg a n be i eM wi Mh w ll 18 6 27 8 Ks ns a z a Te al be a 3 J 3 19 6 28 Sk as S o S Steg ee n ore Me gs 80 6 29 Java f k 83 6 30 hee a ne ae 4 i on rs Banos a os 85 631 Be ge ee te Bett le de i oh ee A 6 32 Mail E g n o a oad Se 2 h be 8 a amp oy 97 6 33 Mkdir eg a 82 a ner a2 os zog m A eo x 98 6 34 a m g no oas wo y Eo a i h nog roa S 99 6 35 P a 48 G rs za fas a4 es 5 D Ms a 8 101 6 36 Patch re SF m A w 3 ee a ee os ee 103 6 37 P aeo ahr cy te Ges a vas a aa ae A a Ss e 6 38 yo oh is 2 mm ms pe Ss m 46 Ge 4 ext 107 6 39 ae A 2 oc ok Ss SA a bo Af te 3 110 6 40 aS a4 Do x o og a ss OS Bo 2 fe a 112 6 41 ane aS moh L n 2 A soh Oe De 113 G42 IRTI a a Oh eee OO se BE a CR a a te 8 ae et G 6 43 Sequential 3 119 6 44 ee e eh ae a eS ee ee IR l ada a eer a a AS a a 2O 6 45 a a ES ak SR ee ee a o a Aae eee a ee DT 6746 Salji ss lt 2 GS 2 sei Secon wee Mad es RED ae ce te a fk Cie Se 20 122 6 47 2 ste oe ee oe ee ta IG 6 48 wie 2 8 od eo es AO AS a SR ook os Oe OS KO ws L129 6 49 of 8 OS el OM OS a OO ee 12 6 50 Touch
64. to map Windows drive letters to Unix paths and vice versa 6 37 2 Parameters Description Required The target architecture Must be one of unix or Must specify one of targetos windows pathsep or dirsep This is a shorthand mechanism for specifying both pathsep and dirsep according to the specified target architecture The character to use as the directory separator in the No defaults to current JVM generated paths File separator The character to use as the path element separator in No defaults to current JVM the generated paths File pathSeparator The name of the property in which to place the Yes converted path What to convert given as a reference p 15 toa No if omitted a nested lt path gt PATH or FILESET defined elsewhere element must be supplied 6 37 3 Parameters specified as nested elements 6 37 3 1 map Specifies the mapping of path prefixes between Unix and Windows Description The prefix to match Note that this value is case insensitive when the build is running on a windows platform and case sensitive when running on a Unix plat form The replacement text to use when from is matched 104 Ant User Manual 6 37 4 Examples Each map element specifies a single replacement map to be applied to the elements of the path being processed If no map entries are specified then no path prefix mapping is performed Note that the map elements are applie
65. to performance maintenance and robustness As a convenience a stylesheet is given in et c directory so that an HTML report can be generated from the XML file 7 19 3 Parameters Description Required The XML file to which the Audit result should be written to Yes metamatahome The home directory containing the Metamata distribution Yes Automatically fix certain errors those marked as fixable in the manual No Default to false Creates listing file for each audited file A maudit file will be generated in the same location as the source file No Default to false Finds declarations unused in search paths It will look for unused global declarations in the source code within a use domain specified by the searchpath element No Default to false Set the maximum memory for the JVM this is a convenient way to set the mx or Xmx argument 224 No Ant User Manual 7 19 4 Nested elements 7 19 4 Nested elements 7 19 4 1 jvmarg Additional parameters may be passed to the VM via nested lt jvmarg gt attributes lt j vmarg gt allows all attributes described in p 14 7 19 4 2 classpath Sets class path also source path unless one explicitly set Overrides METAPATH CLASSPATH environ ment variables The classpath element represents a PATH like structure p 13 7 19 4 3 sourcepath Sets source path Overrides the SOURCEPATH environment variable The sourcepath el
66. within the file data sql with output piped to outputfile txt search ing some jdbc jar as well as the system classpath for the driver class lt sql driver org database jdbcDriver url jdbc database url userid sa password pass src data sql print yes output outputfile txt gt lt classpath gt lt pathelement location some jdbc jar gt lt classpath gt lt sql gt The following will only execute if the RDBMS is oracle and the version starts with 8 1 lt sql driver org database jdbcDriver url jdbc database url userid sa 124 Ant User Manual 6 46 4 Examples password pass src data sql rdbms oracle version 8 1 gt insert into table some_table values 1 2 3 4 truncate table some_other_table lt sql gt 125 6 47 Style 6 47 Style 6 47 1 Description Process a set of documents via XSLT This is useful for building views of XML based documentation or in generating code Note This task depends on external libraries not included in the Ant distribution See Library Dependen p 5 for more information It is possible to refine the set of files that are being copied This can be done with the includes includes file excludes excludesfile and defaultexcludes attributes With the includes or includesfile attribute you specify the files you want to have included by using patterns The exclude or excludesfile attribute is used to specify the files you want to have
67. 10 Ant User Manual 7 15 3 JPCoverage Attribute Description Required class The class mask as a simple regular expression No default to method The method mask as a simple regular expression No default to 7 15 3 3 Example of filters lt filters gt lt include class com mycompany method gt lt exclude class com mycompany MyClass method test gt lt filters gt reports the coverage on all packages classes and methods from com mycompany except all methods starting by test on the class MyClass in the package com mycompany 7 15 3 3 1 triggers Define a number of events to use for interacting with the collection of data performed during coverage For example you may run a whole application but only decide to collect data once it reaches a certain method and once it exits another one The only type of nested element is the method element triggers are performed on method and it has the following attributes Description The name of the method s as a regular expression The name is the fully qualified name on the form package classname method the event on the method that will trigger the action Must be enter or exit wom wow wow the action to execute Must be one of clear pause resume snapshot suspend or exit They respectively clear recording pause recording resume recording take a snapshot suspend the recording and exit the program 7 15
68. 24 5 1 Description Synchronize the current workspace with the depot 7 24 5 2 Parameters Description force a refresh of files sync client to label 7 24 5 3 Examples lt p4sync label nightlybuild 0 0123 force yes gt lt p4sync view depot projects projectfoo main src gt 7 24 6 P4Change 7 24 6 1 Description Request a new changelist from the Perforce server This task sets the p4 change property which can then be passed to P4Submit or P4Edit 7 24 6 2 Parameters 236 Ant User Manual 7 24 7 P4Edit 7 24 6 3 Examples lt p4change description Change Build Number in Script gt 7 24 7 P4Edit 7 24 7 1 Description Open file s for edit P46Change should be used to obtain a new changelist for P4Edit as although P4Edit can open files to the default change P4Submit cannot yet submit it 7 24 7 2 Parameters Description Required The filespec to request to edit Yes An existing changelist number to assign files to No but see above 7 24 7 3 Examples lt p4edit view depot projects projectfoo main src Blah java change p4 change gt 7 24 8 P4Submit 7 24 8 1 Description Submit a changelist usually obtained from P4Change 7 24 8 2 Parameters Attribute Description Required change The changelist number to submit Yes 7 24 8 3 Examples lt p4submit change p4 change gt 7 24 9 P4Have 237 7 24 10 P4Label
69. 3 4 Example of triggers lt triggers gt lt method name ClassName event enter action snapshot gt lt method name ClassName MethodName event exit action exit gt lt triggers gt Will take a snapshot when it enters any method of the class ClLassName and will exit the program once it exits the method Met hodName of the same class oft 7 15 4 JPCovMerge 7 15 4 JPCovMerge 7 15 4 1 Description Perform the merge of several snapshots into a single one 7 15 4 2 Parameters Description Required The directory where is installed JProbe the output filename that will be the result of the name Perform the merge in verbose mode giving details about the snapshot No Default to processing false jpcovmerge collects snapshots using the nested p 25 element 7 15 4 3 Example of merge lt jpcovreport home c jprobe tofile merge jpc verbose true gt lt fileset dir snapshots gt lt include name snap jpc gt lt fileset gt lt jpcovreport gt would run the merge in verbose mode on all snapshot files starting by snap in the directory snapshots The resulting file will be named merge jpc 7 15 5 JPCovReport 7 15 5 1 Description Generate a readable printable report of a snapshot Note that you will need http jakarta apache org oro index html in Ant classpath to run the reference feature 7 15 5 2 Parameters 212 Ant User Manual 7 15 5 JPCovReport Desc
70. 5 Deleting Files As you ve probably guessed by now you use nested fileset elements to select the files to delete from the remote FTP server Again the filesets are relative to the remote directory not a local directory In fact the dir attribute of the fileset is ignored completely lt ftp action del server ftp apache org userid anonymous password me myorg com gt lt fileset gt lt include name tmp gt lt fileset gt lt ftp gt Logs in to ftp apache org as anonymous and tries to delete all tmp files from the default direc tory for that user If you don t have permission to delete a file a BuildException is thrown 7 8 6 Listing Files lt ftp action list server ftp apache org userid anonymous password me myorg com listing data ftp listing gt lt fileset gt lt include name gt lt fileset gt lt ftp gt This provides a file listing in data ftp listing of all the files on the FTP server relative to the default directory of the anonymous user The listing is in whatever format the FTP server normally lists files 7 8 7 Creating Directories Note that with the mkdir action the directory to create is specified using the remotedir attribute 192 Ant User Manual 7 8 7 Creating Directories lt ftp action mkdir server ftp apache org userid anonymous password me myorg com remotedir some remote dir gt This creates the directory some remote dir bene
71. 6 6 Available 6 6 Available 6 6 1 Description Sets a property if a resource is available at runtime This resource can be a file a directory a class in the classpath or a JVM system resource If the resource is present the property value is set to true by default otherwise the property is not set You can set the value to something other than the default by specifying the value attribute Normally this task is used to set properties that are useful to avoid target execution depending on system parameters 6 6 2 Parameters Description The name of the property to set The value to set the property to Defaults to true The class to look for in the classpath The file to look for The resource to look for in the JVM The classpath to use when looking up classname or resource The path to use when looking up file The classpath to use given as afreference p 15 to a path defined elsewhere The type of file to look for either a directory type dir ora file type file If not set the property will be set if the name specified in the file attribute exists as either a file or a directory 6 6 3 Parameters specified as nested elements 6 6 3 1 classpath Available s classpath attribute is a p 13 and can also be set via a nested lt classpath gt element 6 6 3 2 filepath Available s filepath attribute is a p 13 and can also be set via a nested lt filepath gt elem
72. 7 6 53 Unjar Unwar Unzip 6 53 Unjar Unwar Unzip 6 53 1 Description Unzips a zip war or jarfile For JDK 1 1 last modified time field is set to current time instead of being carried from zipfile File permissions will not be restored on extracted files 6 53 2 Parameters Description zipfile to expand directory where to store the expanded files Overwrite files even if they are newer than the corresponding entries in the archive true or false default is true 6 53 3 Examples lt unzip src tomcat_src tools sre zip dest tools home gt 138 Ant User Manual 6 54 Untar 6 54 Untar 6 54 1 Description Untars a tarfile Note File permissions will not be restored on extracted files For JDK 1 1 last modified time field is set to current time instead of being carried from tarfile The untar task recognizes the long pathname entries used by GNU tar 6 54 2 Parameters Description tarfile to expand directory where to store the expanded files Overwrite files even if they are newer than the corresponding entries in the archive true or false default is true 6 54 3 Examples lt gunzip src tools tar gz gt lt untar src tools tar dest tools home gt 139 6 55 Unjar Unwar Unzip 6 55 Unjar Unwar Unzip 6 55 1 Description Unzips a zip war or jarfile For JDK 1 1 last modified time field is set to current time instead of
73. 7 on how the inclusion exclusion of files works and how to write patterns It is possible to use different compilers This can be selected with the build compiler property Here are the choices classic the standard compiler of JDK 1 1 1 2 javacl 1 and javac1 2 can be used as aliases modern the standard compiler of JDK 1 3 1 4 javacl 3 and javac1 4 can be used as aliases jikes the Jikes http oss software ibm com developerworks opensource jikes project compiler jvc the Command Line Compiler from Microsoft s SDK for Java Visual J microsoft can be used as an alias kjc the Kopi http www dms at kopi compiler gcj the gcj compiler from gcc sj Symantec java compiler symantec can be used as an alias extJavac run either modern or classic in a JVM of its own For JDK 1 1 1 2 classic is the default For JDK 1 3 1 4 modern is the default If you wish to use a differ ent compiler interface than those supplied write a class that implements the CompilerAdapter interface package org apache tools ant taskdefs compilers Supply the full classname in the build compiler prop erty The fork attribute overrides the build compiler setting and expects a JDK1 1 or higher to be set in java home 85 6 30 2 Parameters This task will drop all entries that point to non existant files directories from the CLASSPATH it passes to the compiler 6 30 2 Parameters Description Required location of
74. 7 5 2 CCMCheckout 7 5 2 1 Description Task to perform a Checkout command to Continuus 162 Ant User Manual 7 5 3 CCMCheckinTask 7 5 2 2 Parameters Attribute Values Required Path to the file that the command will operate on Specify a comment Specify the task number used to checkin the file may use default path to the ccm executable file required if it is not on the PATH 7 5 2 3 Examples lt ccemcheckout file c wa com foo MyFile java comment mycomment gt Check out the file c Ava com foo MyFile java Comment attribute mycomment is added as a task comment The used task is the one set as the default 7 5 3 CCMCheckinTask 7 5 3 1 Description Task to perform a check in default task command to Continuus 7 5 3 2 Parameters Attribute Values Specify a comment Specify the task number used to check in the file may use default path to the ccm executable file required if it is not on the PATH 7 5 3 3 Examples lt ccemcheckintask comment blahblah gt Does a Checkin default task on all the checked out files in the current task 7 5 4 CCMReconftigure 7 5 4 1 Description Task to perform an reconfigure command to Continuus 163 7 5 5 CCMCreateTask 7 5 4 2 Parameters Attribute Values recurse on subproject default false do a verbose reconfigure operation default false Specifies the ccm project on which the operatio
75. Ant User Manual by Stephane Bailliez sbailliez imediation com Jacques Bergeron jacques bergeron dogico com Stefan Bodewig stefan bodewig epost de Patrick Chanezon chanezon netscape com James Duncan Davidson duncan x180 com Tom Dimock tad1 cornell edu Peter Donald donaldp apache org Diane Holt holtd1 yahoo com Bill Kelly bill kelly softwired inc com Arnout J Kuiper ajkuiper wxs nl Conor MacNeill conor cortexebusiness com au Stefano Mazzocchi stefano apache org Erik Meade emeade geekfarm org Sam Ruby rubys us ibm com Nico Seessle nico seessle de Jon S Stevens jon latchkey com Roger Vaughn rvaughn seaconinc com Dave Walend dwalend cs tufts edu Phillip Wells philwells rocketmail com Version VERSION Id credits html v 1 5 2001 05 18 14 58 38 conor Exp Copyright 2000 2001 Apache Software Foundation All rights Reserved Ant User Manual Table of Contents Table of Contents fers 2 installing Any lca 2 2 System Requirements 2 3 Installing An 24 Baine A 2 5 Library Dependencies 3 Running An ut Rene 1 Running Ant by Hand Danga a S gr oe a OR oe oe ae hoe Tacs Sapte mana me fie Benue Boe a we A neem Bie od 9 5 Concepts and Types 2 ew ee eT ees fe a AEs gt ee SE a a om sh te eee he ot we 5 2 RL ap oe a e a ewe OR a ee a 20 5 3 de a Bs ee OE eee ee e l Sid PatternSetl 5 nw 4 Abe SR Sy e 4R Soe eee OG 2 SSEL og 1G ok Seo Be
76. Ant only For running Ant you will still need to make the jars available as described under Installing Ant p 2 Your are now ready to build Ant build Ddist dir lt directory_to_contain_Ant_distribution gt dist Windows build sh Ddist dir lt directory_to_contain_Ant_distribution gt dist Unix This will create a binary distribution of Ant in the directory you specified The above action does the following If necessary it will bootstrap the Ant code Bootstrapping involves the manual compilation of enough Ant code to be able to run Ant The bootstrapped Ant is used for the remainder of the build steps Invokes the bootstrapped Ant with the parameters passed to the build script In this case these param eters define an Ant property value and specify the dist target in Ant s own build xml file Ant User Manual 2 5 Library Dependencies On most occasions you will not need to explicitly bootstrap Ant since the build scripts do that for you If however the build file you are using makes use of features not yet compiled into the bootstrapped Ant you will need to manually bootstrap Run boot strap bat Windows or bootstrap sh UNIX to build a new bootstrap version of Ant If you wish to install the build into the current ANT_HOME directory you can use build install Windows build sh install Unix You can avoid the lengthy Javadoc step if desired with build install lite Windows b
77. Apache Oro gt lt vajexport gt lt Export selected optional tasks gt lt vajexport destdir sre dir gt lt include name Ant org apache tools ant taskdefs optional ide gt lt vajexport gt lt target gt lt lt i gee lt target name expand gt lt mkdir dir build classes gt lt unzip src antdistribution dir lib crimson jar dest build classes Unzip necessary libraries gt gt lt unzip src antdistribution dir lib jaxp jar dest build classes gt lt delete dir build classes META INF gt lt target gt 270 Ant User Manual 8 5 8 The Plugin lt Compile the source code gt lt target name compile depends expand description compile java sources gt lt mkdir dir build classes gt lt javac srcdir sre dir destdir build classes debug on deprecation off optimize on gt lt classpath refid classpath gt lt include name org apache gt lt exclude name JakartaRegexpMatcher java gt lt javac gt lt target gt gjss lt Copy resources and zip everything together Day gles 2222 y lt target name zip depends compile description creates zip distribution gt lt copy todir build classes gt lt fileset dir src dir gt lt include name org apache gt lt exclude name java gt lt fileset gt lt copy gt lt mkdir dir build
78. At the moment this task can load only project versions This is reflected by the class name It may be extended to load package and class versions too and we didn t want to let these extensions affect the build files Therefore we chose the more general name vajload as task name Q I want to use the same buildfile both within Visual Age and from the command line using my regular Ant environment What do I need to be aware of A The three Visual Age Tasks won t work when executing Ant from the command line Q How do I control the import export of sourcefiles compiled files and project resources explicity A Via the Boolean values exportClasses default false exportSources default true and exportResources default true In some situations Resources are not exported correctly without this being explicity set 8 5 12 Known Problems e Exporting a package containing just resources doesn t work This is a VAJ Tool API bug Workaround create a dummy class and set exportSources to false 8 5 13 VisualAge for Java Versions This tool integration has been tested with versions 3 02 and 3 5 of VisualAge for Java It should run with the 2 x Versions too but we didn t try The graphical user interface is build with AWT so it is JDK inde pendent by now 274 Ant User Manual 8 5 14 History 8 5 14 History 1 0 2000 09 11 Initial Version 1 1 2001 02 14 Added Task documentation and more FAQs thanks to Richard Bo
79. CCESSFUL 251 7 29 3 Examples 7 30 Sound 7 30 Sound 7 30 1 Description Plays a sound file at the end of the build according to whether the build failed or succeeded You can specify either a specific sound file to play or if a directory is specified the lt sound gt task will randomly select a file to play Note At this point the random selection is based on all the files in the directory not just those ending in appropriate suffixes for sound files so be sure you only have sound files in the direc tory you specify 7 30 2 Parameters Description the number of extra times to play the sound file default is 0 the amount of time in milliseconds to play the sound file To specify the sound files or the sound file directories use the nested lt success gt and lt fail gt elements lt success gt the path to a sound file directory or the name of a specific sound file to be played if the build succeeded lt fail gt the path to a sound file directory or the name of a specific sound file to be played if the build succeeded 7 30 3 Examples lt target name fun if fun unless fun done gt lt sound loops 2 gt lt success source user home sounds bell wav gt lt fail source S user home sounds ohno wav gt lt sound gt lt property name fun done value true gt lt target gt plays the be11 wav sound file if the build succeeded or the ohno wav s
80. EJB JAR file are up to date and it will do the minimum amount of work required Like the WebLogic element a naming convention for the EJB descriptors is most commonly used to specify the name for the completed JAR file For example if the EJB descriptor ejb Account ejb jar xml is found in the descriptor directory the iplanet element will search for an iAS specific EJB descriptor file named ejb Account ias ejb jar xml if it isn t found the task will fail and a JAR file named ejb Account jar will be written in the destination directory Note that when the EJB descriptors are added to the JAR file they are automatically renamed META INF ejb jar xml and META INF ias ejb jar xml Of course this naming behavior can be modified by specifying attributes in the ejbjar task for example basejarname basenameterminator and flatdestdir as well as the iplanet element for example suffix Refer to the appropriate documentation for more details 7 7 9 10 Parameters Description The base directory into which the generated JAR files will be written Each JAR file is written in directories which correspond to their location within the descriptordir namespace The classpath used when generating EJB stubs and skeletons If omitted the classpath specified in the ejbjar parent task will be used If specified the classpath elements will be prepended to the classpath specified in the parent ejbjar task Note that nested classpath element
81. Expands a GZip file If dest is a directory the name of the destination file is the same as src with the gz extension removed if present If dest is omitted the parent dir of src is taken The file is only expanded if the source file is newer than the destination file or when the destination file does not exist 6 26 2 Parameters Description the file to expand the destination file or directory 6 26 3 Examples lt gunzip srce test tar gz gt expands fest tar gz to test tar lt gunzip src test tar gz dest test2 tar gt expands fest tar gz to test2 tar lt gunzip src test tar gz dest subdir gt expands test tar gz to subdir test tar assuming subdir is a directory 78 Ant User Manual 6 27 GZip 6 27 1 Description GZips a file 6 27 2 Parameters Description the file to gzip the destination file 6 27 3 Examples lt gzip src test tar zipfile test tar gz gt 79 6 27 GZip 6 28 Jar 6 28 Jar 6 28 1 Description Jars a set of files The basedir attribute is the reference directory from where to jar Note that file permissions will not be stored in the resulting jarfile It is possible to refine the set of files that are being jarred This can be done with the includes includesfile excludes excludesfile and defaultexcludes attributes With the includes or includesfile attribute you specify the files you want to have included by using
82. IED WARRANTIES OF MERCHANTABILITY AND ESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVE SHALL HE HE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DIRECT INCIDENTAL SPECIAL EXEMPLARY OR CONSEQUENTIAL DAMAGES INCLU NG BUT NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS USE DATA OR PROFITS OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON Y THEORY OF LIABILITY WHETHER IN CONTRACT STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF HIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE H H Z ao D Q H Hy POUH PAHH T his software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation For more information on the Apache Software Foundation please see lt http www apache org gt e e E F F F F F F F F F F E E E E E F F F F E E E E E F FF F F E E F FF F F E F FF F F F E OF 279 12 Feedback 12 Feedback To provide feedback on this software please subscribe to the Ant User Mailing List http jakarta apache org site mail html If you want to contribute to Ant or stay current wi
83. ON grammar option This is a string option nodeprefix Sets the NODE_PREFIX grammar option This is a string option 204 Ant User Manual 7 13 3 Example 7 13 3 Example lt jjtree target src Parser jjt outputdirectory build src javacchome c program files JavaCCc nodeusesparser true AS This invokes JJTree on grammar file src Parser jjt writing the generated grammar file Parser jj file to build src The grammar option NODE_USES_PARSER is set to true when invoking JJTree 205 7 14 Jlink 7 14 Jlink 7 14 1 Description Links entries from sub builds and libraries The jlink task can be used to build jar and zip files similar to the jar task However jlink provides options for controlling the way entries from input files are added to the output file Specifically capabilities for merging entries from multiple zip or jar files is available If a mergefile is specified directly eg at the top level of a mergefiles pathelement and the mergefile ends in zip or jar entries in the mergefile will be merged into the outfile A file with any other extension will be added to the output file even if it is specified in the mergefiles element Directories specified in either the mergefiles or addfiles element are added to the output file as you would expect all files in subdirectories are recursively added to the output file with appropriate prefixes in the output file without merging
84. R is not created and the build is halted with an error The Jar task is a shortcut for specifying the manifest file of a JAR file The same thing can be accom plished by using the fullpath attribute of a zipfileset in a Zip task The one difference is that if the manifest attribute is not specified the Jar task will include an empty one for you 6 28 2 Parameters 80 Ant User Manual 6 28 3 Nested elements Description the jar file to create the directory from which to jar the files Not only store data but also compress them defaults to true The character encoding to use for filenames inside the archive Defaults to UTFS8 It is not recommended to change this value as the created archive will most likely be unreadable for Java otherwise Store only file entries defaults to false comma separated list of patterns of files that must be included All files are included when omitted includesfile the name of a file Each line of this file is taken to be an include pattern excludes comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted excludesfile the name of a file Each line of this file is taken to be an exclude pattern indicates whether default excludes should be used or not yes no Default excludes are used when omitted the manifest file to use indicates whether to update or overwrite the destinat
85. Running Ant is simple when you installed it as described in the previous section Just type ant When nothing is specified Ant looks for a build xml file in the current directory If found it uses that file as the buildfile If you use the find option Ant will search for a buildfile in the parent directory and so on until the root of the filesystem has been reached To make Ant use another buildfile use the command line option buildfile file where file is the buildfile you want to use You can also set properties that override properties specified in the buildfile see the p 107 task This can be done with the Dpropert y value option where property is the name of the prop erty and value is the value for that property This can also be used to pass in the value of some environ ment variables You can also access environment variables using the p 107 task Just pass DMYVAR MYVARS Windows or DMYVAR SMYVAR Unix to Ant you can then access these vari ables inside your buildfile as MYVAR Two more options are quiet which instructs Ant to print less information on the console when running and verbose which causes Ant to print additional information to the console It is also possible to specify one or more targets that should be executed When omitted the target that is specified in the default attribute of the lt project gt tag is used The projecthelp option prints out the description of the project if it
86. TH like structure p 13 and can also be set via a nested classpath element 166 Ant User Manual 7 6 6 Examples 7 6 6 Examples lt depend srcdir java dir destdir build classes cache depcache closure yes gt In this example classes in the build classes directory will be removed if they depend on out of date classes Classes are considered out of date with respect to the source in the java dir directory using the same mechanism as the javac task In this instance the depend task caches its dependency information in the depcache directory 167 7 7 Ant EJB Tasks User Manual 7 7 Ant EJB Tasks User Manual by Paul Austin p_d_austin yahoo com Tim Fennell tfenne rcn com Martin Gee martin gee icsynergy com Conor MacNeill conor cortexebusiness com au Greg Nelson greg netscape com Version VERSION Id ejb html v 1 8 2001 08 05 09 31 23 conor Exp 7 7 1 Table of Contents o inroductionl p 168 EJB Tasks p 168 7 7 2 Introduction Ant provides a number of optional tasks for developing Enterprise Java Beans EJBs http java sun com products ejb In general these tasks are specific to the particular vendor s EJB Server At present the tasks support http www borland com Application Server 4 5 e Planet http www iplanet com Application Server 6 0 e http www jboss org and above EJB servers e http www bea com 4 5 1 5 1 and 6 0 EJB server
87. Work Now In the appearing dialog box you can enter the target which you want to compile If a javac error occurs in the ant run an error list opens within Jext With a double click on the error message you jump to the error in the specified java text file 265 8 4 NetBeans Forte for Java unbundled 8 4 NetBeans Forte for Java unbundled See http ant netbeans org 8 5 Visual Age for Java Tasks and Plugin User Manual by Wolf Siberski wolf siberski tui de Christoph Wilhelms christoph wilhelms tui de Version 1 1 2001 02 14 8 5 1 Table of Contents introduction p 266 e The Tasks p 267 p 266 VAILoad ip 2671 o VAIExpori p 2671 o VAImpor p 269 o A sample build file p 270 o The Piugin ip 271 installation p 271 o Usage p 272 Frequently Asked Questiong p 273 o Visual Age Versions p 274 e History p 275 p 275 8 5 2 Introduction Visual Age for Java is a great Java IDE but it lacks decent build support for creating deliveries On the other hand Ant supports the build process very good but is at least at the moment command line based So we decided to write some tasks to access the VAJ repository and a small visual Ant frontend to make running Ant from VAJ possible We use the Tool API to integrate Ant in VisualAge for Java In combina tion with the VAJ tasks vajload vajexport vajimport you can load defined defined versions of projects into your workspa
88. a SimpleDate Format class The numeric offset to the current time The unit of the offset to be applied to the current time Valid Values are millisecond second minute hour day week month year The locale used to create date time string The general form is language country variant but either variant or variant and country may be omitted For more infor mation please refer to documentation for the Locale http java sun com j2se 1 3 docs api java util Locale html class 134 Ant User Manual 6 51 4 Examples 6 51 4 Examples lt tstamp gt sets the standard DSTAMP TSTAMP and TODAY properties according to the default formats lt tstamp gt lt format property TODAY_UK pattern d MMMM yyyy locale en gt lt tstamp gt sets the standard properties as well as the property TODAY_UK with the date time pattern d MMMM yyyy using English locale eg 21 May 2001 lt tstamp gt lt format property touch time pattern MM dd yyyy hh mm aa offset 5 unit hour gt lt tstamp gt Creates a timestamp in the property touch time 5 hours before the current time The format in this example is suitable for use with the lt touch gt task 135 6 52 Typedef 6 52 Typedef 6 52 1 Description Adds a data type definition to the current project such that this new type can be used in the current project Two attributes are needed the name that identifies this data type uniquel
89. ache group storepass secret gt signs the ant jar with alias apache group accessing the keystore and private key via secret password 120 Ant User Manual 6 45 Sleep 6 45 Sleep 6 45 1 Description A task for sleeping a short period of time useful when a build or deployment process requires an interval between tasks 6 45 2 Parameters Description hours to to add to the sleep time minutes to add to the sleep time seconds to add to the sleep time milliseconds milliseconds to add to the sleep time failonerror flag controlling whether to break the build on an error The sleep time is the sum of specified values hours minutes seconds and milliseconds A negative value can be supplied to any of them provided the total sleep time is positive Note that sleep times are always hints to be interpred by the OS how it feels small times may either be ignored or rounded up to a minimum timeslice Note also that the system clocks often have a fairly low granularity too which complicates measuring how long a sleep actually took 6 45 3 Examples lt sleep milliseconds 10 gt Sleep for about 10 mS lt sleep seconds 2 gt Sleep for about 2 seconds lt sleep hours 1 minutes 59 seconds 58 gt Sleep for one hour less 59 58 or two seconds again lt sleep gt Sleep for no time at all This may yield the CPU time to another thread or process 121 6 46
90. ad this file if the named property is set Only read this file if the named property is not set 22 Ant User Manual 5 4 2 Examples 5 4 2 Examples lt patternset id non test sources gt lt include name java gt lt exclude name Test gt lt patternset gt Builds a set of patterns that matches all java files that do not contain the text Test in their name This set can be p 15 to via lt patternset refid non test sources gt by tasks that support this feature or by FileSets Note that while the includes and excludes attributes accept multiple elements separated by commas or spaces the nested lt include gt and lt exclude gt elements expect their name attribute to hold a single pattern The nested elements allow you to use if and unless arguments to specify that the element should only be used if a property is set or that it should be used only if a property is not set For example lt patternset id sources gt lt include name std java gt lt include name prof java if professional gt lt exclude name Test gt lt patternset gt will only include the files in the sub directory prof if the property professional is set to some value The two sets lt patternset includesfile some file gt and lt patternset gt lt includesfile name some file gt lt patternset gt are identical The include patterns will be read
91. ame test Main gt lt java classname test Main fork yes gt lt sysproperty key DEBUG value true gt lt arg value h gt lt jvmarg value Xrunhprof cpu samples file log txt depth 3 gt lt java gt 84 Ant User Manual 6 30 Javac 6 30 Javac 6 30 1 Description Compiles a Java source tree The source and destination directory will be recursively scanned for Java source files to compile Only Java files that have no corresponding class file or where the class file is older than the java file will be compiled Note Ant uses only the names of the source and class files to find the classes that need a rebuild It will not scan the source and therefor will have no knowledge about nested classes classes that are named different from the source file and so on The directory structure of the source tree should follow the package hierarchy It is possible to refine the set of files that are being compiled copied This can be done with the includes includesfile excludes excludesfile and defaultexcludes attributes With the includes or includesfile attribute you specify the files you want to have included by using patterns The exclude or excludesfile attribute is used to specify the files you want to have excluded This is also done with patterns And finally with the defaultexcludes attribute you can specify whether you want to use default exclusions or not See the section on directory based tasks p 1
92. amples Description Reverse the sense of the conversion i e convert from ASCII to native The native encoding the files are in default is the default encoding for the JVM The directory to find files in default is basedir The directory to output file to File extension to use in renaming output files indicates whether default excludes should be used or not yes no Default defaultexcludes excludes are used when omitted comma separated list of patterns of files that must be included All files are included when omitted includes includesfile the name of a file Each line of this file is taken to be an include pattern comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted the name of a file Each line of this file is taken to be an exclude pattern 7 22 2 Examples lt native2ascii encoding EUCJIS src srcdir dest srcdir includes eucjis ext java gt Converts all files in the directory srcdir ending in eucjis from the EUCJIS encoding to ASCII and renames them to end in java lt native2ascii encoding EUCJIS src native japanese dest src includes java gt Converts all the files ending in java in the directory native japanese to ASCII placing the results in the directory src The names of the files remain the same 230 Ant User Manual 7 23 Ne
93. amples This example shows the use of wlrun to run a server under Weblogic 5 1 lt wlrun taskname myserver classpath weblogic boot classpath wlclasspath weblogic classes code jars name myserver home weblogic home properties myserver myserver properties gt This example shows wlrun being used to run the petstore server under Weblogic 6 0 lt wlrun taskname petstore classpath weblogic classes name petstoreServer domain petstore home weblogic home password petstorePassword beahome bea home gt 7 7 8 wlstop 7 7 8 1 Description The wlstop task is used to stop a weblogic instance which is currently running To shut down an instance you must supply both a username and a password These will be stored in the clear in the build script used to stop the instance For security reasons this task is therefore only appropriate in a develop ment environment This task works for most version of Weblogic including 6 0 You need to specify the BEA Home to have this task work correctly under 6 0 7 7 8 2 Parameters Description This attribute selects Weblogic 6 0 shutdown The classpath to be used with the Java Virtual Machine that runs the Weblogic Shutdown comment The username of the account which will be used to shutdown the server The password for the account specified in the user parameter The URL which describes the port to which the server is listening
94. and supports all attributes of lt fileset gt dir becomes base as well as the nested lt include gt lt exclude gt and lt patternset gt elements It is possible to use different compilers This can be selected with the build rmic property There are three choices sun the standard compiler of the JDK kaffe the standard compiler of http www kaffe org weblogic 6 42 2 Parameters 116 Ant User Manual 6 42 3 Parameters specified as nested elements Description the location to store the compiled files the class for which to run rmic indicates whether token filtering should take place sourcebase Pass the keepgenerated flag to rmic and move the generated source file to the base directory stubversion Specify the JDK version for the generated stub code Specify 1 1 to pass the v1 1 option to rmic classpath The classpath to use during compilation classpathref The classpath to use during compilation given as reference p 15 toa PATH defined elsewhere includes comma separated list of patterns of files that must be included All files are included when omitted includesfile the name of a file Each line of this file is taken to be an include pattern excludes comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted excludesfile the name of a file Each line of this file is taken to be a
95. ard weblogic classes should be set with this attribute or equiv alent nested element and the home and remote interfaces located with the standard classpath attribute This controls whether the generic file used as input to ejbc is retained No defaults to false This allows for the selection of a different compiler to be used for the compilation of the generated Java files This could be set for example to Jikes to compile with the Jikes compiler If this is not set and the build compiler property is set to jikes the Jikes compiler will be used If this is not desired the value default may be given to use the default compiler No This flag controls whether weblogic ejbc is always invoked to build the jar file In certain circumstances such as when only a bean class has been changed the jar can be generated by merely replacing the changed classes and not rerunning ejbc Setting this to false will reduce the time to run ejbjar No defaults to true Controls whether weblogic will keep the generated Java files used to build the class files added to the jar This can be useful when debugging No defaults to false Any additional arguments to be passed to the weblogic ejbc tool Deprecated Defines the location of the ejb jar DTD in the weblogic class hierarchy This should not be necessary if you have weblogic in your classpath If you do not you should use a nested lt dtd gt element described above I
96. are present the task will simply generate a generic EJB jar Such jars are typically used as the input to vendor specific deployment tools For each nested deploy ment element a vendor specific deployment tool is run to generate a jar file ready for deployment in that vendor s EJB container The jar files are only built if they are out of date Each deployment tool element will examine its target jar file and determine if it is out of date with respect to the class files and deployment descriptors that make up the bean If any of these files are newer than the jar file the jar will be rebuilt otherwise a message is logged that the jar file is up to date 7 7 9 2 Parameters 176 Ant User Manual 7 7 9 ejbjar Description Required The base directory under which to scan for EJB deployment descrip tors If this attribute is not specified then the deployment descriptors must be located in the directory specified by the srcdir attribute The base directory containing the class files that make up the bean Note that this can be the same as the descriptordir if all files are in the same directory tree The base directory into which generated jar files are deposited Jar files are deposited in directories corresponding to their location within the descriptordir namespace Note that this attribute is only used if the task is generating generic jars i e no vendor specific deployment elements have been specified The
97. ask For example os name expands to the name of the operating system For a list of system properties see the Javadoc of System getProperties http java sun com j2se 1 3 docs api java lang System html getProperties 4 1 6 Example In addition Ant has some built in properties basedir the absolute path of the project s basedir as set with the basedir attribute of lt project gt ant file he absolute path of the buildfile he version of Ant he name of the project that is currently executing t is set in the name attribute of lt project gt he JVM version Ant detected currently it can hold he values 1 1 1 2 1 3 and 1 4 ant version ant project nam ant java version ct ct RB ct ct ct 4 1 6 Example lt project name MyProject default dist basedir gt lt set global properties for this build gt lt property name src value gt lt property name build value build gt lt property name dist value dist gt lt target name init gt N Create the time stamp gt lt tstamp gt lt Create the build directory structure used by compile gt lt mkdir dir build gt lt target gt lt target name compile depends init gt lt Compile the java code from src into build gt lt javac srcdir src destdir build gt lt target gt lt target name dist depends compile gt lt Create the distribution direc
98. asspath For the current version of Ant you will also need a JDK installed on your system version 1 1 or later A future version of Ant will require JDK 1 2 or later 2 3 Installing Ant The binary distribution of Ant consists of three directories bin docs and lib Only the bin and lib directories are required to run Ant To install Ant choose a directory and copy the distribution file there This directory will be known as ANT_HOME Ant User Manual 2 3 1 Optional Tasks Windows 95 and Windows 98 Note On these systems the script used to launch Ant will have problems if ANT_HOME is a long filename This is due to limitations in the OS s handling of the for batch file statement It is recommended therefore that Ant be installed in a short path such as C Ant Before you can run ant there is some additional set up you will need to do e Add the bin directory to your path Set the ANT_HOME environment variable to the directory where you installed Ant On some operat ing systems the ant wrapper scripts can guess ANT_HOME Unix dialects and Windows NT 2000 but it is better to not rely on this behavior Optionally set the JAVA_HOME environment variable see the Advanced p 4 section below This should be set to the directory where your JDK is installed Note Do not install Ant s ant jar file into the lib ext directory of the JDK JRE Ant is an application whilst the extension directory is intended for JDK
99. ath the default root directory As with all other actions the directory separator character must be correct according to the desires of the FTP server 193 7 9 icontract 7 9 icontract 7 9 1 Description Instruments Java classes with Contract http www reliable systems com tools DBC preprocessor The task can generate a properties file for iControl http home sol no hellesoy icplus html a graphical user interface that lets you turn on off assertions iControl generates a control file that you can refer to from this task using the controlfile attribute 7 9 2 Parameters 194 Ant User Manual 7 9 2 Parameters Description Required Location of the java files Yes Indicates where the instrumented source files should go Yes Indicates where the repository source files should go Yes Indicates where the compiled instrumented classes should go No Defaults to the value of instrumentdir NOTE Don t use the same directory for compiled instrumented classes and uninstrumented classes It will break the dependency checking Classes will not be reinstrumented if you change them Indicates where the compiled repository classes should go Defaults to the value of repositorydir Indicates whether or not to instrument for preconditions Defaults to true unless controlfile is specified in which case it defaults to false Indicates whether or not to instrument for postconditions Defaults to
100. attribute instead don t disable warning messages build compiler pedantic enable pedantic warnings build compiler fulldepend 89 enable full dependency checking F in the jikes manual 6 31 Javadoc Javadoc2 6 31 Javadoc Javadoc2 6 31 1 Description Generates code documentation using the javadoc tool The source directory will be recursively scanned for Java source files to process but only those matching the inclusion rules and not matching the exclusions rules will be passed to the javadoc tool This allows wildcards to be used to choose between package names reducing verbosity and management costs over time This task however has no notion of changed files unlike the p 85 task This means all packages will be processed each time this task is run In general however this task is used much less frequently This task works seamlessly between different javadoc versions 1 1 and 1 2 with the obvious restriction that the 1 2 attributes will be ignored if run in a 1 1 VM NOTE since javadoc calls System exit javadoc cannot be run inside the same VM as ant without break ing functionality For this reason this task always forks the VM This overhead is not significant since javadoc is normally a heavy application and will be called infrequently NOTE the packagelist attribute allows you to specify the list of packages to document outside of the Ant file It s a much better practice to include e
101. attributes like includes il and excludes broken il can be used to control the files pulled in Each file is built on its own producing an appropriately named output file unless manually specified with outfile Attribute Description Example defaultexcludes indicates whether default excludes should be used or not yes no Default excludes are used when omitted include debug information true default comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted excludesfile the name of a file Each line of this file is taken to be an exclude pattern extraOptions Any extra options which aren t explicitly supported by the ilasm task primarily because they arent really documented use ilasm to see them failOnError Should a failed compile halt the build true default Should error text provide the full path to files true default comma separated list of patterns of files that must be included All files are included when omitted the name of a file Each line of this file is taken to be an include pattern the name of a file containing a private key with which the assembly output is checksumed and then MDS signed to have a strong name Produce a listing off by default Listings go to the current output on off stream default filename of output example exe name of resource file to include reso
102. b secutest ejb jar clientjar lib client jar debug true mode java gt lt classpath gt lt pathelement locacation mymodule jar gt lt classpath gt lt blgenclient gt 186 Ant User Manual 7 7 11 BorlandDeployTool 7 7 11 BorlandDeployTool 7 7 11 1 Description The BorlandDeployTool is a vendor specific nested element for the Ejbjar optional task BorlandDeploymentTool is dedicated to the Borland Application Server 4 5 It generates and compiles the stubs and skeletons for all ejb described into the Deployment Descriptor builds the jar file including the support files and verify whether the produced jar is valid or not 7 7 11 2 Borland element Description Required The base directory into which the generated borland ready jar files are deposited yes If true turn on the debug mode for each borland tools java2iiop iastool default false If true turn on the verification at the end of the jar production default false extra parameter for verify command no no String value appended to the basename of the deployment descriptor to No defaults create the filename of the Borland EJB jar file to ejb jar Deprecated Defines the location of the weblogic ejb jar DTD which covers the Borland specific deployment descriptors This should not be necessary if you have borland in your classpath If you do not you should use a nested lt dtd gt element described above Deprecated
103. base name that is used for the generated jar files If this attribute is specified the generic jar file name will use this value as the prefix followed by the value specified in the genericjarsuffix attribute and the resultant ejb jar file followed by any suffix specified in the nested element basenameterminator String value used to substring out a string from the name of each No defaults deployment descriptor found which is then used to locate related to deployment descriptors e g the WebLogic descriptors For example a basename of and a deployment descriptor called FooBean ejb jar xml would result in a basename of FooBean which would then be used to find FooBean weblogic ejb jar xml and FooBean weblogic cmp rdbms jar xml as well as to create the file names of the jar files as FooBean generic jar and FooBean wl jar This attribute is not used if the basejarname attribute is specified genericjarsuffix String value appended to the basename of the deployment descriptor No defaults to create the filename of the generic EJB jar file to generic jar This classpath is used when resolving classes which are to be added to the jar Typically nested deployment tool elements will also support a classpath which will be combined with this classpath when resolving classes Set this attribute to true if you want all generated jars to be placed in the root of the destdir rather than acc
104. being carried from zipfile File permissions will not be restored on extracted files 6 55 2 Parameters Description zipfile to expand directory where to store the expanded files Overwrite files even if they are newer than the corresponding entries in the archive true or false default is true 6 55 3 Examples lt unzip src tomcat_src tools sre zip dest tools home gt 140 Ant User Manual 6 56 Unjar Unwar Unzip 6 56 Unjar Unwar Unzip 6 56 1 Description Unzips a zip war or jarfile For JDK 1 1 last modified time field is set to current time instead of being carried from zipfile File permissions will not be restored on extracted files 6 56 2 Parameters Description zipfile to expand directory where to store the expanded files Overwrite files even if they are newer than the corresponding entries in the archive true or false default is true 6 56 3 Examples lt unzip src tomcat_src tools sre zip dest tools home gt 141 6 57 Uptodate 6 57 Uptodate 6 57 1 Description Sets a property if a target files are more up to date than a set of Source files Source files are specified by nested lt srcfiles gt elements these are p 25 s while target files are specified using a nested mapper p 28 element The value part of the property being set is true if the timestamp of the target files is more recent than the timestamp
105. by the bootstrap class loader Specify where to find user class files by refer lence p 15 to a PATH defined elsewhere bootclasspathref Override location of class files loaded by the bootstrap class loader by reference p 15 toa PATH defined elsewhere Extdirs Override location of installed extensions Overview Read overview documentation from HTML file Access mode one of public protected package or private No default protected Show only public classes and members Show protected public classes and members default Show package protected public classes and members Show all classes and members Generate output using JDK 1 1 emulating doclet Output messages about what Javadoc is doing Locale to be used e g en_US or en_US_WIN Source file encoding name Include version paragraphs Create class and package usage pages Include author paragraphs Split index into one file per letter Browser window title for the documentation text Include title for the package index first page html code 91 6 31 2 Parameters Include header text for each page html code Include footer text for each page html code Include bottom text for each page html code Create links to javadoc output at the given URL Link to docs at lt url gt using package list at lt url2 gt separate the
106. ccess this help from the Workbench create the directory C IBMV Java ide tools org apache tools ant doc and copy the files VAJAntTool html toolmenu gif and anttool1 gif to it VAJ has to be restarted to recognize the new tool e Now if You open the context menu of a project You should see the entry Ant Build in the Tools submenu see Usage p 272 Make sure the tool works as expected Now You can remove Ant and the imported XML parser from Your workspace and optionally add the IBM parser again 8 5 10 Usage Beeing sure the tool is installed correctly and your Ant build file is configured it is really easy to use Go to your Workbench select the project you want to deploy and open its context menu In the submenu Tools you should find the new entry Ant Build Klick it to start the tool Oi tum begs Attribute Filters file Edit Warkspace Import lA Export Replace with Delete Reorganize Manage Ont Build deploy 09 Compare With gt z Enterprise Access Builder gt gt Make Run gt Mme Document gt Peet y ze Servlet Launcher gt Tools WebLogic Server Tools gt Properties i 272 Ant User Manual 8 5 11 Frequently Asked Questions After a short time this frame should pop up ee Ant VisualAge for Java Tool Integration File Help Projectname Test Ant Buildfile m Target Message Level into This frame c
107. ce export the source code compile it with an external compiler and build a jar without leaving the IDE Of course compile messages are viewed in a logging window Concluding This tool provides decent deployment support VAJ has not out of the box 266 Ant User Manual 8 5 3 The Tasks 8 5 3 The Tasks At the moment there are three tasks which help integrating the VAJ repository contents into an external build process iV AJLoad p 267 loads specified versions into the workspace WV AJExport p 267 exports specified packages into the file system V AJImport p 269 imports specified files into the workspace These tasks are described in detail below 8 5 4 VAJLoad 8 5 4 1 Description Loads a specified VAJ project version into the workspace 8 5 4 2 Parameters none 8 5 4 3 Parameters specified as nested elements 8 5 4 3 1 vajproject Description name of the VAJ project to load into the workspace name of the requested version 8 5 4 4 Example lt vajload gt lt vajproject name My Testcases version 1 7beta gt lt vajproject name JUnit version 3 2 gt lt vajload gt 8 5 5 VAJExport 267 8 5 5 VAJExport 8 5 5 1 Description Exports Java source files class files and or resources from the workspace to the file system Exports can be specified by giving the VAJ project name and package name s This works very similar to p 25 8 5 5 2 Parameters Description l
108. ce tree It is also used to derive the name of the jar file which is generated For the example this would be Account jar Vendor specific files are assumed to be named in a similar fashion The deployment descriptor file which defines additional weblogic specific information for the above bean would be Account weblogic ejb jar xml The second approach does not require a naming convention This approach uses a specified a jar name for the resultant ejb jar If the jar name is present then no naming convention is required If the jar name is not specified then the default naming convention is expected for the deployment descriptor files The task works as a directory scanning task and performs an action for each deployment descriptor found As such the includes and excludes should be set to ensure that all desired EJB1 1 descriptors are found but no application server descriptors are found For each descriptor found ejbjar will parse the deployment descriptor to determine the necessary class files which implement the bean These files are assembled along with the deployment descriptors into a well formed EJB jar file Any support files which need to be included in the generated jar can be added with the lt support gt nested element For each class included in 175 7 7 9 ejbjar the jar ejbjar will scan for any super classes or super interfaces These will be added to the generated jar If no nested vendor specific deployment elements
109. cense Version 1 1 Copyright C 1999 The Apache Software Foundation All rights reserved Redistribution and use in source and binary forms with or without modifica tion are permitted provided that the following conditions are met 1 Redistributions of source code must retain the above copyright notice this list of conditions and the following disclaimer 2 Redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution 3 The end user documentation included with the redistribution if any must include the following acknowledgment This product includes software developed by the Apache Software Foundation http www apache org Alternately this acknowledgment may appear in the software itself if and wherever such third party acknowledgments normally appear 4 The names Ant and Apache Software Foundation must not be used to endorse or promote products derived from this software without prior written permission For written permission please contact apache apache org 5 Products derived from this software may not be called Apache nor may Apache appear in their name without prior written permission of the Apache Software Foundation Tj HIS SOFTWARE IS PROVIDED AS IS AND ANY EXPRESSED OR IMPLIED WARRANTIES CLUDING BUT NO LIMITED TO THE IMPL
110. ch depend will not detect If the Java compiler optimizes away a class relationship there can be a source dependency without a class dependency Non public classes cause two problems Firstly depend cannot relate the class file to a source file In the future this may be addressed using the source file attribute in the classfile Secondly neither depend nor the compiler tasks can detect when a non public class is missing Inner classes are handled by the depend task 7 6 4 Parameters Description This is the directory where the source exists depend will examine this to determine which classes are out of date If you use multiple source directories you can pass this attribute a path of source directories This is the root directory of the class files which will be analysed If this is not present the srcdir is used This is a directory in which depend can store and retrieve dependency information If this is not present depend will not use a cache This attribute controls whether depend only removes classes which directly depend on out of date classes If this is set to true depend will traverse the class depen dency graph deleting all affected classes Defaults to false If true the dependency information will be written to the debug level log The classpath containg jars and classes for which lt depend gt should also check dependencies 7 6 5 Nested Elements depend s classpath attribute is a PA
111. ck Sets the FORCE_LA_CHECK grammar option This is a boolean option ignorecase Sets the IGNORE_CASE grammar option This is a boolean option javaunicodeescape Sets the JAVA_UNICODE_ESCAPE grammar option This is a boolean option lookahead Sets the LOOKAHEAD grammar option This is an integer option optimizetokenmanager Sets the OPTIMIZE_TOKEN_MANAGER grammar option This is a boolean option otherambiguitycheck Sets the OTHER_AMBIGUITY_CHECK grammar option This is an integer option Sets the SANITY_CHECK grammar option This is a boolean option Sets the STATIC grammar option This is a boolean option Sets the UNICODE_INPUT grammar option This is a boolean option Sets the USER_CHAR_STREAM grammar option This is a boolean option usertokenmanager Sets the USER_TOKEN_MANAGER grammar option This is a boolean option 198 Ant User Manual 7 10 3 Example 7 10 3 Example lt javacc target src Parser jj outputdirectory build src javacchome c program files JavaCc static true AS This invokes JavaCC on grammar file src Parser jj writing the generated files to build src The grammar option STATIC is set to true when invoking JavaCC 199 7 11 Javah 7 11 Javah 7 11 1 Description Generates JNI headers from a Java class When this task executes it will generate the C header and source files that are needed to implement native
112. classes doc gt lt copy todir build classes doc overwrite yes gt lt fileset dir antdistribution dir docs gt lt include name VAJAnttool html toolmenu gif anttooll gif gt lt fileset gt lt copy gt lt copy file antdistribution dir src main org apache tools ant taskdefs optional ide default ini todir build classes overwrite yes gt lt mkdir dir zip dir gt lt zip basedir build classes zipfile zip dir anttool zip gt lt target gt lt xias lt target name clean depends preparedirs description removes all files from src and build tree gt lt delete gt lt fileset dir sre dir gt lt delete gt lt delete gt lt fileset dir build classes gt lt delete gt lt delete gt lt fileset dir zip dir gt lt delete gt lt target gt lt Cleans the build dir loads required project versions exports gt lt compiles and zips the Plugin iaa lt target name buildall depends clean load export zip description build all gt lt target gt lt project gt 8 5 8 The Plugin The tasks are usable within VAJ by running the org apache tools ant Main class but this is quite inconve nient Therefore a small GUI is provided which allows selecting a build file and executing its targets This Plugin is accessible from the VAJ Tools menu see Usage p 272 8 5 9 Installation At the moment the installation has it s rough edg
113. cription Changes the permissions of a file or all files inside specified directories Right now it has effect only under Unix The permissions are also UNIX style like the argument for the chmod command See the section on directory based tasks p 17 on how the inclusion exclusion of files works and how to write patterns This task holds an implicit p 25 and supports all of FileSet s attributes and nested elements directly More FileSets can be specified using nested lt fileset gt elements 6 7 2 Parameters Description Required the file or single directory of which the permissions must exactly one of the two or be changed nested lt fileset gt elements the directory which holds the files whose permissions must be changed the new permissions comma separated list of patterns of files that must be included includesfile the name of a file Each line of this file is taken to be an include pattern excludes comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted excludesfile the name of a file Each line of this file is taken to be an No exclude pattern defaultexcludes indicates whether default excludes should be used or not No yes no Default excludes are used when omitted process all specified files using a single chmod command No Defaults to true One of file dir or both If set to file only the
114. cters are to be handled Valid values for this property are add convert sequences of spaces which span a tab stop to tabs asis leave tab and space characters alone remove convert tabs to spaces Default for this parameter is asis N B When the attribute javafiles see above is true literal TAB charac ters occurring within Java string or character constants are never modified This functionality also requires the recognition of Java style comments N B There is an incompatibility between this and the previous version in the handling of white space at the end of lines This version does not remove trailing whitespace on lines TAB character interval Valid values are between 2 and 80 inclusive The default for this parameter is 8 Specifies how DOS end of file control Z characters are to be handled Valid values for this property are add ensure that there is an EOF character at the end of the file asis leave EOF characters alone remove remove any EOF character found at the end Default is based on the platform on which you are running this task For Unix platforms the default is remove For DOS based systems including Windows the default is asis 6 23 3 Examples lt fixcrlf srcdir src ol l1f eof remove includes sh gt Replaces EOLs with LF characters and removes eof characters from the shell scripts Tabs and spaces are left as is lt fixcrlf srcdir
115. d after execution 195 7 9 2 Parameters Note iContract will use the java compiler indicated by the project s build compiler property See documentation of the Javac task for more information Nested includes and excludes are also supported Example Note iContract will use the java compiler indicated by the project s build compiler property See documentation of the Javac task for more information Nested includes and excludes can be done very much the same way as any subclass of MatchingTask Example lt icontract srcdir S build src instrumentdir S build instrument repositorydir build repository builddir build instrclasses updateicontrol true classdir build classes controlfile control targets targets verbosity error warning quiet true lt classpath refid compile classpath gt lt icontract gt 196 Ant User Manual 7 10 JavaCC 7 10 JavaCC 7 10 1 Description Invokes the http www metamata com javacc compiler compiler on a grammar file To use the javacc task set the target attribute to the name of the grammar file to process You also need to specify the directory containing the JavaCC installation using the javacchome attribute so that ant can find the JavaCC classes Optionally you can also set the outputdirectory to write the generated file to a specific directory Otherwise javacc writes the generated files to the directory containing the grammar
116. d as nested elements 6 20 4 Parameters specified as nested elements 6 20 4 1 arg Command line arguments should be specified as nested lt arg gt elements See p 14 6 20 4 2 env It is possible to specify environment variables to pass to the system command via nested lt env gt elements Please note that the environment of the current Ant process is not passed to the system command if you specify variables using lt env gt Description Required The name of the environment variable Yes The literal value for the environment variable The value for a PATH like environment variable You can use or as path separators and Ant will convert it to the platform s local conventions Exactly one of these The value for the environment variable Will be replaced by the absolute file name of the file by Ant 6 20 4 2 1 Examples lt exec executable emacs gt lt env key DISPLAY value 1 0 gt lt exec gt starts emacs on display 1 of the X Window System lt exec gt lt env key PATH path S java library path basedir bin gt lt exec gt adds basedir bin to the PATH of the system command Note Although it may work for you to specify arguments using a simple arg element and separate them by spaces it may fail if you switch to a newer version of the JDK JDK lt 1 2 will pass these as separate arguments to the program you are calling JDK gt 1 2 will pass them as a
117. d gt assword lt read gt lt write gt badpass lt write gt lt read gt home bob lt read gt lt write gt ls lt write gt lt read gt home bob lt read gt lt telnet gt 257 7 33 3 Examples A timeout can be specified at the lt telnet gt level or at the lt read gt level This will connect issue a sleep command that is suppressed from displaying and wait 10 seconds before quitting lt telnet userid bob password badpass server localhost timeout 20 gt lt read gt home bob lt read gt lt writ cho false gt sleep 15 lt write gt lt read timeout 10 gt home bob lt read gt lt telnet gt The task can be used with other ports as well lt telnet port 80 server localhost timeout 20 gt lt read gt lt write gt GET http 0 9 lt write gt lt write gt lt read timeout 10 gt amp 1t HTML gt lt read gt lt telnet gt 258 Ant User Manual 7 34 Test 7 34 Test 7 34 1 Description This is a primitive task to execute a unit test in the org apache testlet framework 7 34 2 Parameters Attribute Description showSuccess a boolean value indicating whether tests should display a message on success showBanner a boolean value indicating whether a banner should be displayed when start ing testlet engine forceShowTrace a boolean indicating that a stack trace is displayed on any failure showTrace a boolean indicating that a stack trace is displayed on e
118. d in the order specified and the only the first matching map element is applied So the ordering of your map elements can be important if any from values are prefixes of other from values 6 37 3 2 path If a path reference is not supplied using the refid attribute then a nested path element must be supplied See Path like Structures p 13 for details 6 37 4 Examples In the examples below assume that the property wl home has the value d weblogic on Windows and weblogic on Unix 6 37 4 1 Example 1 lt path id wl path gt lt pathelement location wl home lib weblogicaux jar gt lt pathelement location wl home classes gt lt pathelement location wl home mssqlserver4 classes gt lt pathelement location c winnt System32 gt lt path gt lt pathconvert targetos unix property newpath refid wl path gt Assuming wl property has the value d weblogic will generate the path shown below and store it in the property named newpath weblogic lib weblogicaux jar weblogic classes weblogic mssqlserver4 classes WINNT SYSTEM32 Note that the drive letters have been removed This is the default behavior when no map elements have been specified 6 37 4 2 Example 2 lt pathconvert targetos unix property newpath gt lt path id wl path gt lt pathelement location wl home lib weblogicaux jar gt lt pathelement location wl home classes gt lt pathelement location wl ho
119. delete gt lt fileset dir includes bak gt lt delete gt deletes all files with the extension bakquot from the current directory and any sub directories lt delete includeEmptyDirs true gt lt fileset dir build gt lt delete gt deletes all files and subdirectories of build including build itself 61 6 15 Deltree 6 15 Deltree 6 15 1 Deprecated This task has been deprecated Use the Delete task instead 6 15 2 Description Deletes a directory with all its files and subdirectories 6 15 3 Parameters Attribute Description Required dir the directory to delete Yes 6 15 4 Examples lt deltree dir dist gt deletes the directory dist including its files and subdirectories lt deltree dir S dist gt deletes the directory dist including its files and subdirectories 62 Ant User Manual 6 16 DependSet 6 16 DependSet A task to manage arbitrary dependencies between files 6 16 1 Description The dependset task compares a set of source files with a set of target files If any of the source files is more recent than any of the target files all of the target files are removed Source files and target files are specified via nested p 25 and or nested p 24 Arbi trarily many source and target filesets filelists may be specified but at least one filelist fileset is required for both sources and targets Use a FileSet when you want to use wildca
120. der Weblogic 6 0 The location of the weblogic home that is to be used This Yes Note this is is the location where weblogic is installed the absolute loca tion not relative to BEA home The domain to which the server belongs The classpath to be used with the Java Virtual Machine that runs the Weblogic Server Prior to Weblogic 6 0 this is typically set to the Weblogic boot classpath Under Weblogic 6 0 this should include all the weblogic jars The weblogic classpath used by the Weblogic Server The name of the server s properties file within the weblogic home directory used to control the weblogic instance The name of the weblogic server within the weblogic home which is to be run This defaults to myserver The name of the security policy file within the weblogic home directory that is to be used If not specified the default policy file weblogic policy is used The management username used to manage the server The server s management password The private key password so the server can decrypt the SSL private key file Additional argument string passed to the Java Virtual Machine used to run the Weblogic instance Additional argument string passed to the Weblogic instance 7 7 7 3 Nested Elements The wlrun task supports nested lt classpath gt and lt wlclasspath gt elements to set the repsective classpaths 173 7 7 8 wlstop 7 7 7 4 Ex
121. der with password javal and uploads all new or changed HTML files in the htdocs manual directory to the pub incoming directory The files are transferred in text mode Passive mode has been switched on to send files from behind a firewall lt ftp server ftp nt org remotedir c uploads userid coder password javal separator verbose yes lt fileset dir htdocs manual gt lt include name html gt lt fileset gt lt ftp gt Logs in to the Windows based ftp nt org as coder with password javal and uploads all HTML files in the htdocs manual directory to the c uploads directory Progress messages are displayed as each file is uploaded 7 8 4 Getting Files Getting files from an FTP server works pretty much the same way as sending them does The only differ ence is that the nested filesets use the remotedir attribute as the base directory for the files on the FTP server and the dir attribute as the local directory to put the files into The file structure from the FTP site is preserved on the local machine 191 7 8 5 Deleting Files lt ftp action get server ftp apache org userid anonymous password me myorg com gt lt fileset dir htdocs manual gt lt include name html gt lt fileset gt lt ftp gt Logs in to ftp apache org as anonymous and recursively downloads all html files from default directory for that user into the ht docs manual directory on the local machine 7 8
122. dings of DOS descendant file system conventions removed from the build xml files 7 1 3 Key net Tasks csc csharp compiler csc gt output ilasm IL assembler il gt exe or dll ResX ResXToResources exe resx gt resources al assembly linker dll gt Signcode exe keys gt exe Resgen properties gt resources Type Library Exporter TIbExp exe dll gt tlb TlbImp exe Type Library Importer RegAsm exe Assembly Registration Tool dll gt reg registration CONDNAKRWNE 7 1 4 Ant Wrapper for net tasks Rarely used net command line tools can be invoked manually The key tasks to address are the common steps in a build process and those which benefit from the file pattern matching function 150 Ant User Manual 7 1 5 Plan The esoteric tasks can then supported on demand by those who need them The initial net tasks should provide a foundation for that demand creation to be simple 7 1 5 Plan nABRWN code up C sharp task and distribute for feedback amp identify possible aid Use for a real end to end development task Add the next task I need whatever that is Refactor to produce a base class for net tasks Leave it other people write all the other tasks 7 1 6 Risks The net SDK is unstable the next builds will change the commands arguments and behaviours Probability 100 Impact 2 days Portable tasks turn out to be harder than envisaged rew
123. dition will be evaluated 6 8 3 4 available This condition is identical to the Available p 45 task all attributes and nested elements of that task are supported the property and value attributes are redundant and will be ignored 6 8 3 5 uptodate This condition is identical to the Uptodate p 142 task all attributes and nested elements of that task are supported the property and value attributes are redundant and will be ignored 6 8 3 6 os Test whether the current operating system is of a given type Supported values for the family attribute are windows for all versions of Microsoft Windows dos for all Microsoft DOS based operating systems including Microsoft Windows and OS 2 mac for all Apple Macintosh systems unix for all Unix and Unix like operating systems 6 8 3 7 equals Tests whether the two given Strings are identical Description First string to test Second string to test 6 8 4 Examples lt condition property javamail complete gt lt and gt lt available classname Javax activation DataHandler gt lt available classname javax mail Transport gt lt and gt lt condition gt 50 Ant User Manual 6 8 4 Examples sets the property javamail complete if both the JavaBeans Activation Framework and JavaMail are available in the classpath lt condition property isMacOsButNotMacOsX gt lt and gt lt os family mac gt lt not gt lt os family
124. e 7 12 3 Nested Elements jdepend supports two nested elements lt classpath gt and lt sourcespath gt that represent PATH ike structares ip 13 202 Ant User Manual 7 12 4 Examples lt sourcespath gt is used to define the paths of the source code to analyze 7 12 4 Examples lt jdepend classpathref base path gt lt sourcespath gt lt pathelement location sre gt lt sourcespath gt lt jdepend gt This invokes JDepend on the src directory writing the output on the standard output The classpath is defined using a classpath reference lt jdepend outputfile docs jdepend txt fork yes gt lt sourcespath gt lt pathelement location sre gt lt sourcespath gt lt classpath gt lt pathelement location classes gt lt pathelement location lib jdepend jar gt lt classpath gt lt jdepend gt This invokes JDepend in a separate VM on the src and testsrc directories writing the output in the lt docs jdepend txt gt file The classpath is defined using nested elements 203 7 13 JJTree 7 13 JJTree 7 13 1 Description Invokes the http www metamata com javacc preprocessor for the JavaCC compiler compiler It inserts parse tree building actions at various places in the JavaCC source that it generates The output of JJTree is run through JavaCC to create the parser To use the jjtree task set the target attribute to the name of the jjtree grammar file to process
125. e Hello World MyVeryOwnTask works gt lt target gt lt project gt 277 9 2 Build Events Another way to add a task more permanently is to add the task name and implementing class name to the default properties file in the org apache tools ant taskdefs package Then you can use it as if it were a built in task 9 2 Build Events Ant is capable of generating build events as it performs the tasks necessary to build a project Listeners can be attached to Ant to receive these events This capability could be used for example to connect Ant to a GUI or to integrate Ant with an IDE To use build events you need to create an ant Project object You can then call the addBuildLis tener method to add your listener to the project Your listener must implement the org apache tools antBuildListener interface The listener will receive BuildEvents for the following events Build started Build finished Target started Target finished Task started Task finished Message logged If you wish to attach a listener from the command line you may use the listener option For example ant listener org apache tools ant XmlLogger will run Ant with a listener that generates an XML representation of the build progress This listener is included with Ant as is the default listener which generates the logging to standard output 278 Ant User Manual 10 Ant API 10 Ant API 11 License The Apache Software Li
126. e org foo bar Bobble gt lt javah gt is similar to the previous example except the output is written to a file called wibble h in the current directory 200 Ant User Manual lt javah destdir c lt class name org lt class name org lt class name org lt javah gt writes three header files 7 11 3 Examples force yes gt foo bar Wibble gt foo bar Bobble gt foo bar Tribble gt one for each of the classes named Because the force option is set these header files are always written when the Javah task is invoked even if they already exist verbose yes old yes foo bar Wibble gt foo bar Bobble gt foo bar Tribble gt force yes gt lt javah destdir c lt class name org lt class name org lt class name org lt javah gt lt javah destdir c lt class name org lt class name org lt class name org lt javah gt verbose yes stubs yes old yes force yes gt foo bar Wibble gt foo bar Bobble gt foo bar Tribble gt writes the headers for the three classes using the old JNI format then writes the corresponding c stubs The verbose option will cause Javah to describe its progress 201 7 12 JDepend 7 12 JDepend 7 12 1 Description Invokes the http www clarkware com software JDepend html parser This parser traverses a set of Java source file directories and generates design quality met
127. e specified as a nested lt title gt element with text contents and the packages may be listed with nested lt package gt elements as for the main task 6 31 3 10 doclet The doclet nested element is used to specify the doclet that javadoc will use to process the input source files A number of the standard javadoc arguments are actually arguments of the standard doclet If these are specified in the javadoc task s attributes they will be passed to the doclet specified in the lt doclet gt nested element Such attributes should only be specified therefore if they can be interpreted by the doclet in use If the doclet requires additional parameters these can be specified with lt param gt elements within the lt doclet gt element These paramaters are restricted to simple strings An example usage of the doclet element is shown below lt javadoc gt lt doclet name theDoclet path path to theDoclet gt lt param name foo value foovalue gt lt param name bar value barvalue gt lt doclet gt lt javadoc gt 6 31 3 11 sourcepath classpath and bootclasspath Javadoc s sourcepath classpath and bootclasspath attributes are PATH like structure p 13 and can also be set via nested sourcepath classpath and bootclasspath elements respectively 95 6 31 4 Example 6 31 4 Example lt javadoc packagenames com dummy test sourcepath src excludepackagenames com dummy test doc files d
128. e task will only work on win2K until other platforms support csc exe or an equivalent CSC exe must be on the execute path too All parameters are optional lt csc gt should suffice to produce a debug build of all cs files References to external files do require explicit enumeration so are one of the first attributes to consider adding 152 Ant User Manual 7 1 9 Task CSC The task is a directory based task so attributes like includes cs and excludes broken cs can be used to control the files pulled in By default all cs files from the project folder down are included in the command When this happens the output file if not specified is taken as the first file in the list which may be somewhat hard to control Specifying the output file with outfile seems prudent Attribute Description Example Values additionalModules Semicolon separated list of modules to refer to defaultexcludes indicates whether default excludes should be used or not true default or false definitions defined constants RELEASE BETA1 include debug information true default or false name of file for documentation doc xml comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted the name of a file Each line of this file is taken to be an exclude pattern Any extra options which aren t explicit
129. ec Ignored if fork is disabled the arguments to pass to the forked VM ignored if fork is disabled depre cated use nested lt jvmarg gt elements instead Max amount of memory to allocate to the forked VM ignored if fork is disabled failonerror Stop the buildprocess if the command exits with a returncode other than 0 Only available if fork is true The directory to invoke the VM in ignored if fork is disabled Name of a file to write the output to 6 29 3 Parameters specified as nested elements 83 6 29 4 Examples 6 29 3 1 arg and jvmarg Use nested lt arg gt and lt jvmarg gt elements to specify arguments for the or the forked VM See Command line arguments p 14 6 29 3 2 sysproperty Use nested lt sysproperty gt elements to specify system properties required by the class These proper ties will be made available to the VM during the execution of the class either ANT s VM or the forked VM The attributes for this element are the same as for environment variables p 69 6 29 3 3 classpath Java s classpath attribute is a PATH like structure p 13 and can also be set via a nested classpath element 6 29 3 3 1 Example lt java classname test Main gt lt arg value h gt lt classpath gt lt pathelement location test jar gt lt pathelement path java class path gt lt classpath gt lt java gt 6 29 4 Examples lt java classn
130. ee nme Se eo es a d ok et eas ce a A 5 6 ent he te a Bute Ue ae ce Oe th A oh 3 S 5 7 Filterset 3 ae de A Aone BON om amp cm amp Se Be 226 5 8 Filterset a 33 a et a BO te oe UR RE 5 9 Filter Go ce em 4 gO Sek we ee we eG 5 10 Filtersfile ee Sh cue we Be Gi a a ON ve Oe OR ol a dete Go ay AZ 5 11 Srs DAS d a a eS 5 12 Common Attributes of all Tasks Common Auributes or all Tasks bd ap Ve Sk a A BY Sr Sarg ar ng 222 6 Aa eS As ee ok E ee 6 1 Overview of Ant core tasks Overview of Ant core taski e ooh amp ek Be oo se ee 6 2 An amp Bem Oh oS a et ca a ol we oe Ao 6 3 AntCall math ooh a oe ge ek ee Se 4 Ke See CSS 6 4 AntStructure acs Ol ak AR ga OBR We owe ee by ae ee Oe 0 6 5 Apply Exec0n ogy ak eS A me amp Bowe me Roe A 6 6 Available sue td ke we EO Oe ee RE a 5 6 7 ae ee a good A oa ee a Ga AT 6 8 Condition 0a 6 9 Copy 4 aa 52 6 10 Copydi a A 6 11 Copyfile S25 a aa 56 GAZ ICS a s a se e a a Rw ms ao a a aoai SI 6 13 koe Se ot wee A a owes vr a BS a Go ee Gp a o9 6 14 Delete if Ay a a aaa 0 6 15 bhia ae See be A Aoi aa e g a AS a aao a 3D 6 16 S E Ae pp a aa O3 6 17 Eo Ch e ga ee a a ae a I oe FE Ge eee ae OD 6 18 Example os aaa 66 6 19 ho a eog Se a a G Oe A daoa ae a 6T OoNuUuURANNNN e Table of Contents 6 20 er oo f ar TERRE S g G Sts a oS 68 6 21 Fail m 3 ba we be g wog p ag oa aa me oh D g 70 6 22 2 LU a iS at 2 4
131. efaultexcludes yes destdir docs api author true version true use true windowtitle Test API gt lt doctitle gt lt CDATA lt h1 gt Test lt h1 gt gt lt doctitle gt lt bottom gt lt CDATA lt i gt Copyright amp 169 2000 Dummy Corp All Rights Reserved lt i gt gt lt bottom gt lt group title Group 1 Packages packages com dummy test a gt lt group title Group 2 Packages packages com dummy test b com dummy test c gt lt link offline true href http java sun com products jdk 1 2 docs api packagelistLoc C tmp gt lt link href http developer java sun com developer products xml docs api gt 1t javadoc gt 96 Ant User Manual 6 32 Mail 6 32 Mail 6 32 1 Description A task to send SMTP email Text and text files to include in the message body may be specified To send binary attachments the optional p 226 task should be used instead 6 32 2 Parameters Description Required Email address of sender Yes Comma separated list of recipients Yes Message to send in the body of the email Filename s of text to send in the body of the email Multiple files are Yes comma separated Host name of the mail server No default to local host Email subject line No 6 32 3 Examples lt mail from me tolist you subject Results of nightly build files build log gt Sends an eMail from me to you with a subject of Results of nightly b
132. ement repre sents a PATH like structure p 13 7 19 4 4 sourcepath Sets the search path to use as the use domain when looking for unused global declarations The search path element represents a PATH like structure p 13 7 19 4 5 fileset Sets the Java files to audit via a FILESET p 25 structure Whatever the filter is only the files that ends with java will be included for processing Note that the base directory used for the fileset MUST be the root of the source files otherwise package names deduced from the file path will be incorrect 7 19 5 Example lt maudit tofile c metamata examples auditexamples audit xml metamatahome c metamata fix yes gt lt classpath gt lt pathelement location c metamata examples auditexamples gt lt classpath gt lt sourcepath gt lt pathelement location c metamata examples auditexamples gt lt classpath gt lt fileset dir c metamata examples auditexamples gt lt include name java gt lt fileset gt lt maudit gt This invokes Metamata Audit installed in c metamata on the audit examples and fix automatically the fixable errors 225 7 20 MimeMail 7 19 6 Generating a report As a convenience there is an XSL file maudit frames xsl that allows you to generate a full framed HTML report of the metrics You can find it in the etc directory of Ant As it uses the Xalan extensions you will need BSF Xalan and Xerces to run it The stylesheet take
133. ent 45 6 6 4 Examples 6 6 4 Examples lt available classname org whatever Myclass property Myclass present gt sets the Myclass present property to the value true if the class org whatever Myclass is found in Ant s classpath lt property name jaxp jar value lib jaxpl1l1 jaxp jar gt lt available file S jaxp jar property jaxp jar present gt sets the jaxp jar present property to the value true if the file lib jaxp11 jaxp jar is found lt available file usr local lib type dir property local lib present gt sets the local lib present property to the value true if the directory usr local lib is found vsin project lt property name jaxp jar value lib jaxpll jaxp jar gt lt path id Jjaxp location jaxp jar gt in target lt available classname javax xml transform Transformer classpathref jaxp property jaxpll present gt sets the jaxpll present property to the value true if the class javax xml trans form Transformer is found in the classpath referenced by jaxp in this case lib jaxpl11 jaxp jar lt available property have extras resource extratasks properties gt lt classpath gt lt pathelement location usr local ant extra jar gt lt classpath gt lt available gt sets the have ext ras property to the value true if the resource file extratasks properties is found 46 Ant User Manual 6 7 Chmod 6 7 Chmod 6 7 1 Des
134. eported This setting emulates the f option to the Unix rm command true false Default is false meaning things are noisy Setting this to true implies setting failonerror to false This flag which is only of relevance if quiet is false controls whether an error such as a failure to delete a file stops the build task or is merely reported to the screen The default is true includeEmptyDirs Set to true to delete empty directories when using filesets Default is false includes Deprecated Comma separated list of patterns of files that must be deleted All files are in the current directory and any sub directories are deleted when omitted includesfile Deprecated The name of a file Each line of this file is taken to be an include pattern excludes Deprecated Comma separated list of patterns of files that must be excluded from the deletion list No files except default excludes are excluded when omitted excludesfile Deprecated The name of a file Each line of this file is taken to be an exclude pattern defaultexcludes Deprecated Indicates whether default excludes should be used or not yes no Default excludes are used when omitted 60 Ant User Manual 6 14 3 Examples 6 14 3 Examples lt delete file lib ant jar gt deletes the file lib ant jar lt delete dir lib gt deletes the 1ib directory including all files and subdirectories of Lib lt
135. er will use to browse README s 75 6 24 GenKey 6 24 GenKey 6 24 1 Description Generates a key in keystore 6 24 2 Parameters Description Required the alias to add under password for keystore integrity keystore location keystore type password for private key if different the algorithm to use in signing the method to use when generating name value pair true false verbose output when signing The distinguished name for entity integer indicates how many days certificate is valid integer indicates the size of key generated Alternatively you can specify the distinguished name by creating a sub element named dname and popu lating it with param elements that have a name and a value When using the subelement it is automatically encoded properly and are replace The following two examples are identical 6 24 3 Examples lt genkey alias apache group storepass secret dname CN Ant Group OU Jakarta Division O Apache org C US gt lt genkey alias apache group storepass Secret gt lt dname gt lt param name CN value Ant Group gt lt param name 0U value Jakarta Division gt lt param name 0 value Apache Org gt lt param name C value US gt lt dname gt lt genkey gt 76 Ant User Manual 6 25 Get 6 25 Get 6 25 1 Description Gets a file from a URL When the verbose option is on this task disp
136. es If something described below doesn t work for You it s probably not Your fault but incomplete wrong instructions In this case please contact one of the p 266 We assume C IBMVJava as VAJ install directory If You have installed it elsewhere adapt the pathes below Execute following steps to get the PlugIn up and running 271 8 5 10 Usage install the Visual Age IDE Tools via File gt Quick Start gt Add feature gt IBM IDE Utility class libraries import an appropriate XML parser to VAJ we use Xerces 1 2 0 and are happy with it Unfortunately the XML parser delivered with VAJ in the project IBM XML Parser for Java doesn t work with Ant You have to remove that project temporarily from the workspace before importing another XML implementation import the Ant sources into VAJ Create the directory C IBMVJava ide tools org apache tools ant export the Ant and XML parser class files into this directory Be sure to select class files and resources Sources don t have to be exported Some optional tasks have errors and can t be exported when You don t have the necessary packages in Your workspace e g junit task ejbc task If You need this tasks either import these packages into VAJ too or copy the class files directly from the binary distribution copy default ini in jakarta ant src taskdefs optional ide to C IBMV Java ide tools org apache tools ant default ini if you want to a
137. es that match the include patterns and don t match the exclude patterns are used Patterns can be specified inside the buildfile via task attributes or nested elements and via external files Each line of the external file is taken as a pattern that is added to the list of include or exclude patterns 5 1 1 Patterns As described earlier patterns are used for the inclusion and exclusion These patterns look very much like the patterns used in DOS and UNIX gt matches zero or more characters matches one character Examples x java matches java x java and FooBar java but not FooBar xml does not end with java java matches x java A java but not java or xyz java both don t have one character before java Combinations of s and s are allowed Matching is done per directory This means that first the first directory in the pattern is matched against the first directory in the path to match Then the second directory is matched and so on For example when we have the pattern abc java and the path xabc foobar test java the first abc is matched with xabc then is matched with foobar and finally java is matched with test java They all match so the path matches the pattern To make things a bit more flexible we add one extra feature which makes it possible to match multiple directory levels This can be used to match a complete directory tree or a file anywhere in the directo
138. ese imports can be specified with a fileset 8 5 6 2 Parameters Description imported files are added to this VAJ project export source files default yes importResources export resource files default yes importClasses export class files default no 8 5 6 3 Parameters specified as nested elements 8 5 6 3 1 fileset A p 25 specifies the files to import 8 5 6 4 Example lt vajimport project Test importClasses true gt lt fileset dir import dir gt lt include name com sample class gt lt exclude name com sample test gt lt fileset gt lt vajimport gt This example imports all class files in the directory import dir com sample excluding those in the subdirectory test 269 8 5 7 A sample build file 8 5 7 A sample build file This is a sample build file which builds a zip file useful for distribution of the VAJ plugin The build file exports a specific version of Ant compiles it extracts necessary helper classes and zips everything together This is useful as complete example as well as to deploy Ant in a team where all developers use VAJ The resulting zip file must be unzipped in lt VAJIn stallDir gt ide tools org apache tools ant For more information see the p 271 section lt xml versio lt project name anttool default buildall basedir c temp anttool gt lt property name src dir value basedir src gt lt p
139. eter mined by this attribute and the extension of formatter No default is TEST name using the name attribute Only run test if the named property is set Only run test if the named property is not set Tests can define their own formatters via nested lt formatter gt elements 7 16 3 5 batchtest Define a number of tests based on pattern matching batchtest collects the included files from any number of nested p 25 s It then gener ates a test class name for each file that ends in java or class 217 7 16 4 Examples Description Required Run the tests in a separate VM Overrides value set in lt junit gt Stop the build process if an error occurs during the test run Over rides value set in lt junit gt errorProperty The name of a property to set in the event of an error Overrides value set in lt junit gt haltonfailure Stop the build process if a test fails errors are considered failures as well Overrides value set in lt junit gt failureProperty The name of a property to set in the event of a failure errors are considered failures as well Overrides value set in lt junit gt todir Directory to write the reports to No default is current directory Only run tests if the named property is set Only run tests if the named property is not set Batchtests can define their own formatters via nested lt formatter gt elements 7 16 4 E
140. example when preparing archives for Unix systems where some files need to have execute permission Early versions of tar did not support path lengths greater than 100 characters Modern versions of tar do so but in incompatible ways The behaviour of the tar task when it encounters such paths is controlled by the longfile attribute If the longfile attribute is set to fail any long paths will cause the tar task to fail If the longfile attribute is set to truncate any long paths will be truncated to the 100 character maximum length prior to adding to the archive If the value of the longfile attribute is set to omit then files contain ing long paths will be omitted from the archive Either option ensures that the archive can be untarred by any compliant version of tar If the loss of path or file information is not acceptable and it rarely is long file may be set to the value gnu The tar task will then produce a GNU tar file which can have arbitrary length paths Note however that the resulting archive will only be able to be untarred with GNU tar The default for the longfile attribute is warn which behaves just like the gnu option except that it produces a warning for each file path encountered that does not match the limit Note that this task does not perform compression You might want to use the GZip p 79 task to prepare a tar gz package 6 48 2 Parameters 129 6 48 3 Nested Elements Description the tar file to create
141. exists followed by a list of this project s targets First those with a description then those without one Command line option summary 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 that 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 Dproperty value set property to value 3 0 1 Examples ant runs Ant using the build xml file in the current directory on the default target ant buildfile test xml 3 1 Running Ant by Hand runs Ant using the test xml file in the current directory on the default target ant buildfile test xml dist runs Ant using the test xml file in the current directory on a target called dist ant buildfile test xml Dbuild build classes dist runs Ant using the test xml file in the current directory on a target called dist setting the build property to the value build classes 3 0 2 Files The Ant wrapper script for Unix will source read and evaluate the file antrc before
142. extensions In particular there are security restrictions on the classes which may be loaded by an extension 2 3 1 Optional Tasks Ant supports a number of optional tasks An optional task is a task which typically requires an external library to function The optional tasks are packaged separately from the core Ant tasks This package is available in the same download directory as the core ant distribution The current jar containing optional tasks is named jakarta ant 1 4 optional jar This jar should be downloaded and placed in the lib directory of your Ant installation The external libraries required by each of the optional tasks is detailed in the Library Dependencies p 5 section These external libraries may either be placed in Ant s lib directory where they will be picked up automatically or made available on the system CLASSPATH environment variable 2 3 2 Windows Assume Ant is installed in c ant The following sets up the environment set ANT_HOME c ant set JAVA_HOME c jdk1 2 2 set PATH PATH SANT_HOME bin 2 3 3 Unix bash Assume Ant is installed in usr local ant The following sets up the environment export ANT_HOME usr local ant export JAVA_HOME usr local jdk 1 2 2 export PATH PATH ANT_HOME bin 2 4 Building Ant 2 3 4 Advanced There are lots of variants that can be used to run Ant What you need is at least the following The classpath for Ant mus
143. f omitted it defaults to no May be used to specify the home directory for this iAS installation This is used to find the ejbc utility if it isn t included in the user s system path If spec ified it should refer to the install location iplanet ias6 ias directory If omitted the ejbc utility must be on the user s system path 7 7 6 3 Examples lt iplanet ejbc ejbdescriptor ejb jar xml lasdescriptor ias ejb jar xml dest S build classesdir classpath ias ejbc cpath gt lt iplanet ejbc ejbdescriptor ejb jar xml lasdescriptor ias ejb jar xml 171 7 7 7 wlrun dest S build classesdir keepgenerated yes debug yes lashome S ias home gt lt classpath gt lt pathelement path gt lt pathelement path build classpath gt lt classpath gt lt iplanet ejbc gt 7 7 7 wirun 7 7 7 1 Description The wlrun task is used to start a weblogic server The task runs a weblogic instance in a separate Java Virtual Machine A number of parameters are used to control the operation of the weblogic instance Note that the task and hence ant will not complete until the weblogic instance is stopped 7 7 7 2 Parameters 172 Ant User Manual 7 7 7 wlrun Description Required Required for 6 0 for 4 5 1 and 5 1 The location of the BEA Home qwhere the server s N A config is defined If this attribute is present wlrun assumes that the server will be running un
144. f the generated classes If the generated classes are not present or are out of date the ejbc tool is run to generate new versions 7 7 5 2 Parameters Description This is the base directory from which the serialised deployment descriptors are selected The base directory where the generated classes RIM stubs and RMI skeletons are written manifest The name of a manifest file to be written This manifest will contain an entry for each EJB processed The base directory of the source tree containing the source files of the home inter face remote interface and bean implementation classes This classpath must include both the weblogic ejbc class and the classfiles of the bean home interface remote interface etc of the bean being processed 7 7 5 3 Examples lt ejbc descriptors gen classes src sre dir dest S gen classes manifest build manifest classpath descriptorbuild classpath gt lt include name ser gt lt ejbe gt 170 Ant User Manual 7 7 6 iplanet ejbc 7 7 6 iplanet ejbc 7 7 6 1 Description Task to compile EJB stubs and skeletons for the iPlanet Application Server 6 0 Given a standard EJB 1 1 XML descriptor as well as an iAS specific EJB descriptor this task will generate the stubs and skeletons required to deploy the EJB to iAS Since the XML descriptors can include multiple EJBs this is a conve nient way of specifying many EJBs in a single Ant task
145. f you do choose to use an attribute you should use the ejbdtd attribute in preference to this one anyway Deprecated Defines the location of the weblogic ejb jar DTD which covers the Weblogic specific deployment descriptors This should not be necessary if you have weblogic in your classpath If you do not you should use a nested lt dtd gt element described above Deprecated Defines the location of the ejb jar DTD in the weblogic class hierarchy This should not be necessary if you have weblogic in your classpath If you do not you should use a nested lt dtd gt element described above If this is set to true the new method for locating CMP descriptors will be used No Defaults to false Deprecated This is an antonym for newCMP which should be used instead 180 No Ant User Manual 7 7 9 ejbjar noEJBC If this attribute is set to true Weblogic s ejbe will not be run on the EJB jar Use this if you prefer to run ejbc at deployment time The weblogic nested element itself supports two nested elements lt classpath gt and lt wlclasspath gt which are used to set the respective classpaths These nested elements are useful when setting up class paths using reference Ids 7 7 9 7 TOPLink for Weblogic element The TopLink element is used to handle beans which use Toplink for the CMP operations It is derived from the standard weblogic element so it supports the same set of attributes please t
146. file This task only invokes JavaCC if the grammar file is newer than the generated Java files javacc assumes that the Java class name of the generated parser is the same as the name of the grammar file ignoring the jj If this is not the case the javacc task will still work but it will always generate the output files 7 10 2 Parameters 197 7 10 2 Parameters Description The grammar file to process The directory containing the JavaCC distribution outputdirectory The directory to write the generated files to If not set the files are written to the directory containing the grammar file buildparser Sets the BUILD_PARSER grammar option This is a boolean option buildtokenmanager Sets the BUILD_TOKEN_MANAGER grammar option This is a boolean option cachetokens Sets the CACHE_TOKENS grammar option This is a boolean option choiceambiguitycheck Sets the CHOICE_AMBIGUITY_CHECK grammar option This is an integer option commontokenaction Sets the COMMON_TOKEN_ACTION grammar option This is a boolean option debuglookahead Sets the DEBUG_LOOKAHEAD grammar option This is a boolean option debugparser Sets the DEBUG_PARSER grammar option This is a boolean option debugtokenmanager Sets the DEBUG_TOKEN_MANAGER grammar option This is a boolean option errorreporting Sets the ERROR_REPORTING grammar option This is a boolean option forcelache
147. files to a replacing TITLE with Foo Bar in all files lt copy todir backup dir gt lt fileset dir src_dir gt lt filterset gt lt filter token TITLE value Foo Bar gt lt filterset gt lt copy gt 53 6 10 Copydir 6 10 Copydir 6 10 1 Deprecated This task has been deprecated Use the Copy task instead 6 10 2 Description Copies a directory tree from the source to the destination It is possible to refine the set of files that are being copied This can be done with the includes includes file excludes excludesfile and defaultexcludes attributes With the includes or includesfile attribute you specify the files you want to have included by using patterns The exclude or excludesfile attribute is used to specify the files you want to have excluded This is also done with patterns And finally with the defaul texcludes attribute you can specify whether you want to use default exclusions or not See the section on directory based tasks p 17 on how the inclusion exclusion of files works and how to write patterns This task forms an implicit p 25 and supports all attributes of lt fileset gt dir becomes src as well as the nested lt include gt lt exclude gt and lt patternset gt elements 6 10 3 Parameters Description the directory to copy the directory to copy to comma separated list of patterns of files that must be included All files are included when omitted
148. from the JUnit testing framework The latest version of the framework can be found at This task has been tested with JUnit 3 0 up to JUnit 3 7 it won t work with versions prior to JUnit 3 0 Tests are defined by nested test or batchtest tags see nested elements p 215 7 16 2 Parameters Description Required Print one line statistics for each testcase Can take the values on off and No default withOutAndErr withOutAndErr is the same as on but also includes is off the test s output written to System out and System err Run the tests in a separate VM No default is ofi n Stop the build process if an error occurs during the test run No default is ofi n The name of a property to set in the event of an error No Stop the build process if a test fails errors are considered failures as well No default is off failureProperty The name of a property to set in the event of a failure errors are considered failures as well timeout Cancel the individual tests if the don t finish in the given time measured in milliseconds Ignored if fork is disabled maxmemory Max amount of memory to allocate to the forked VM ignored if fork is disabled the command used to invoke the Java Virtual Machine default is java No default The command is resolved by java lang Runtime exec Ignored if fork is java disabled The directory to invoke the VM in ignored if fork i
149. g in to the StarTeam server The password of the account used to log in to the StarTeam server The folder to which files are checked out The subfolder in the project from which to check out files Overwrite existing folders if this is set to true Defaults to false Indicates if subfolders should be searched for files to check out Defaults to true Provides progress information Defaults to false Only check out files that match at least one of the patterns in this list Patterns must be seperated by spaces Patterns in excludes take precedence over patterns in includes Do not check out files that match at least one of the patterns in this list Patterns must be seperated by spaces Patterns in excludes take precedence over patterns in includes 254 Ant User Manual 7 31 3 Examples 7 31 3 Examples lt starteam servername STARTEAM serverport 49201 projectname AProject viewname AView username auser password secret target folder C dev buildtest co gt The minimum necessary to check out files out from a StarTeam server This will check out all files in the AView view of the AProject project to C dev buildtest co lt starteam servername STARTEAM serverport 49201 projectname AProject viewname AView username auser password secret target folder C dev buildtest co foldername Dev excludes bak old force true
150. g the resource attribute with the resource name of the property file to load This property file has the format as defined by the file used in the class java util Properties By setting the environment attribute with a prefix to use Properties will be defined for every environ ment variable by prefixing the supplied name and a period to the name of the variable Although combinations of the three ways are possible only one should be used at a time Problems might occur with the order in which properties are set for instance The value part of the properties being set might contain references to other properties These references are resolved at the time these properties are set This also holds for properties loaded from a property file A list of predefined properties can be found here p 11 6 38 2 Parameters 107 6 38 3 Parameters specified as nested elements Description Required the name of the property to set No the value of the property Sets the property to the absolute filename of the given file If the value of this attribute is an absolute path it is left unchanged with and characters converted to the current platforms conventions Otherwise it is taken as a path relative to the project s basedir and expanded Reference p 15 to an object defined elsewhere Only yields reasonable results for references to PATH like structures p 13 or properties One of these when using the
151. ge com mycompany except the method that start by test from the class MyClass 7 15 5 4 Recommendation If you generate your main code and your testcases in a separate directory say bin classes and test classes You should mostly end up with a reference such as lt reference gt lt classpath path bin classes gt lt reference gt With such a reference your XML report will be cleaned up against parasite classes from your testcases that as a common practice generally match the exact package structure of the class you exercise 7 15 5 5 HTML reports You will find in Ant etc directory a stylesheet called coverage frames xsl This file can be used to generate a framed report a la javadoc similar to the one for JUnit It needs either Xalan 1 2 2 or Xalan 2 x Xalan 1 2 2 you must have xalan jar and bsf jar in your classpath lt style processor xalan in reports xml results xml out reports html dummy file style S ant home etc coverage frames xsl gt lt param name output dir expression S basedir reports html gt lt style gt Xalan 2 x note the parameter without single quote lt style processor trax in reports xml results xml out reports html dummy file style S ant home etc coverage frames xsl gt lt param name output dir expression basedir reports html gt lt style gt 214 Ant User Manual 7 16 JUnit 7 16 JUnit 7 16 1 Description This task runs tests
152. gt Source file name Target file name A java A java foo bar B java B java C properties C propert Classes dir dir2 A properties A properti 5 11 0 3 merge The target file name will always be the same as defined by to from will be ignored 5 11 0 3 1 Examples lt mapper type merge to archive tar gt Source file name Target file name A java archive tar foo bar B java archive tar C properties archive tar Classes dir dir2 A properties archive tar 5 11 0 4 glob Both to and from define patterns that may contain at most one For each source file that matches the from pattern a target file name will be constructed from the to pattern by substituting the in the to pattern with the text that matches the in the from pattern Source file names that don t match the from pattern will be ignored 29 5 11 Mapping File Names Examples lt mapper type glob from java to java bak gt Source file name Target file name A java A java bak foo bar B java foo bar B java bak C properties ignored Classes dir dir2 A properties ignored lt mapper type glob from C ies to Q y gt Source file name Target file name A java ignored foo bar B java ignored C properties O property Classes dir dir2 A properties Qlasses dir dir2 A property 5 11 0 5 regexp Both to and from def
153. h 65 6 18 Example 6 17 3 Nested elements 6 17 3 1 metainf The nested met ainf element specifies a p 25 All files included in this fileset will end up in the META INF directory of the ear file If this fileset includes a file named MANIFEST MF the file is ignored and you will get a warning 6 18 Example lt ear earfile build dir myapp ear appxml src dir metadata application xml gt lt fileset dir build dir includes jar war gt lt ear gt 66 Ant User Manual 6 19 Echo 6 19 Echo 6 19 1 Description Echoes a message to System out or a file 6 19 2 Parameters Description Required the message to echo Yes unless data is included in a character section within this element the file to write the message No to Append to an existing file No default is false 6 19 3 Examples lt echo message Hello world gt lt echo gt This is a longer message stretching over two lines lt echo gt 67 6 20 Exec 6 20 Exec 6 20 1 Description Executes a system command When the os attribute is specified then the command is only executed when Ant is run on one of the specified operating systems 6 20 2 Parameters Description Required the command to execute with all command line arguments deprecated use executable and nested lt arg gt elements instead Exactly one of the two the command to execute w
154. he Move task instead FReplace ip 1131 Replace is a directory based task for replacing the occurrence of a given string with another string in selected file Rmidip 116 Runs the rmic compiler for a certain class Sequentaltp 1191 Sequential is a container task it can contain other Ant tasks The nested tasks are simply executed in sequence Sequential s primary use is to support the sequential execution of a subset of tasks within the p 101 task SignJar p 120 Signs a jar or zip file with the javasign command line tool Sieeplip 121 A task for sleeping a short period of time useful when a build or deployment process requires an interval between tasks Sqi p 122 Executes a series of SQL statements via JDBC to a database Statements can either be read in from a text file using the src attribute or from between the enclosing SQL tags Stylel p 126 Process a set of documents via XSLT Far p 129 Creates a tar archive p 132 Adds a task definition to the current project such that this new task can be used in the current project Fouelip 1331 Changes the modification time of a file and possibly creates it at the same time fFStamplip 1341 Sets the DSTAMP TSTAMP and TODAY properties in the current project based on the current date and time Eypedei ip 1361 Adds a data type definition to the current project such that this new type can be used i
155. he metrics example Note that here classpath and sourcepath are not normally not needed 7 18 6 Generating a report As a convenience there is an XSL file mmetrics frames xsl that allows you to generate a full framed HTML report of the metrics You can find it in the etc directory of Ant As it uses the Xalan extensions you will need BSF Xalan and Xerces to run it The stylesheet takes an output dir parameter otherwise it will be generated in the current directory it can be run in Ant as follows 223 7 19 MAudit lt java classname org apache xalan xslt Process gt lt param lt param lt param lt param lt param lt param lt param lt java gt value IN gt value metrics xml gt value XSL gt value mmetrics frames xsl gt value PARAM gt value output dir gt value amp quot report dir amp quot gt 7 19 MAudit by Stephane Bailliez sbailliez imediation com 7 19 1 Requirements This task requires Metamata Development environment 2 0 Webgain Quality Analyzer 2 0 An evaluation version is available at http www webgain com products quality_analyzer http jakarta apache org oro and a XML parser via JAXP 7 19 2 Description Invokes the Metamata Audit Webgain Quality Analyzer on a set of Java files maudit performs static analysis of the Java source code and byte code files to find and report errors of style and potential problems related
156. helement path additional path gt lt classpath gt lt javac gt lt target gt lt project gt could be rewritten as lt project gt lt path id project class path gt lt pathelement location lib gt lt pathelement path java class path gt lt pathelement path additional path gt lt path gt 15 4 1 10 References lt target sss gt SMEG gai lt classpath refid project class path gt lt rmic gt lt target gt lt target gee gt lt javac gt lt classpath refid project class path gt lt javac gt lt target gt lt project gt All tasks that use nested elements for PatternSet p 22 s p 25 s or p 13 accept references to these structures as well 16 Ant User Manual 5 Concepts and Types 5 Concepts and Types 5 1 Directory based Tasks Some tasks use directory trees for the task they perform For example the javac p 85 task which works upon a directory tree with java files Sometimes it can be very useful to work on a subset of that direc tory tree This section describes how you can select a subset of such a directory tree Ant gives you two ways to create a subset both of which can be used at the same time Only include files directories that match at least one pattern of a set of patterns Exclude files directories that match at least one pattern a set of patterns When both inclusion and exclusion are used only files directori
157. helper test classes that you do not want to appear in the report but are unable to filter without adding hundred of filters for all your classes add classes that exists in the reference set and match the filters but are not reported remove abstract methods that are incorrectly reported in JProbe 3 0 should be fixed in a later SP remove classes methods that do not match the filters 7 15 5 2 3 classpath Path to the reference set of files can be set via nested classpath elements that are PATH like struc furesp 13 7 15 5 2 4 filters Nested elements are include and exclude withaclass and method attribute 213 7 15 5 JPCovReport Attribute Description Required class The class mask as a simple regular expression No default to method The method mask as a simple regular expression No default to 7 15 5 3 Example of report lt jpcovreport home c jprobe snapshot merge jpc format xml tofile result xml gt lt sourcepath path srce gt lt reference gt lt classpath path bin classes gt lt filters gt lt include class com mycompany gt lt exclude class com mycompany MyClass method test gt lt filters gt lt reference gt lt jpcovreport gt would generate the report of the file merge jpc and write it to result xml using the source path src As well it will modify the result xml by analyzing all classes in the bin classes that are port of the packa
158. hese additional attributes Attribute Description Required toplinkdescriptor This specifies the name of the TOPLink deployment Yes descriptor file contained in the descriptordir direc tory toplinkdtd This specifies the location of the TOPLink DTD file No defaults to dtd file at This can be a file path or a file URL This attribute is www objectpeople com not required but using a local DTD is recommended 7 7 9 8 Examples This example shows ejbjar being used to generate deployment jars using a Weblogic EJB container This example requires the naming standard to be used for the deployment descriptors Using this format will create a ejb jar file for each variation of ejb jar xml that is found in the deployment descriptor direc tory lt ejbjar srcdir build classes descriptordir descriptor dir gt lt weblogic destdir deploymentjars dir classpath descriptorbuild classpath gt lt include name ejb jar xml gt lt exclude name weblogic xml gt lt ejbjar gt If weblogic is not in the Ant classpath the following example shows how to specify the location of the weblogic DTDs This example also show the use of a nested classpath element lt ejbjar descriptordir sre dir srcdir build classes gt lt weblogic destdir deployment webshop dir keepgeneric true args g keepgenerated S ejbc compiler suffix jar oldCMP false gt lt cla
159. hild elements get set via their corresponding set XXX methods at runtime 10 execute is called at runtime While the above initialization steps only occur once the execute method may be called more than once if the task is invoked more than once For example if targetl and target2 both depend on target3 then running ant targetl target2 will run all tasks in target 3 twice 9 1 2 Example Let s write our own task which prints a message on the System out stream The task has one attribute called message package com mydomain import org apache tools ant BuildException import org apache tools ant Task public class MyVeryOwnTask extends Task private String msg The method executing the task public void execute throws BuildException System out printin msg The setter for the message attribute public void setMessage String msg this msg msg It s really this simple Adding your task to the system is rather simple too 1 Make sure the class that implements your task is in the classpath when starting Ant 2 Add a lt taskdef gt element to your project This actually adds your task to the system 3 Use your task in the rest of the buildfile 9 1 3 Example lt xml version 1 0 gt lt project name OwnTaskExample default main basedir gt lt taskdef name mytask classname com mydomain MyVeryOwnTask gt lt target name main gt lt mytask messag
160. his situation could be considered as the person running the build file knows more about the environment than the person writing the build file ignore The system classpath is ignored This situation is the reverse of the above The person running the build trusts the build file writer to get the build file right last The classpath is concatenated to any specified classpaths at the end This is a compromise where the build file writer has priority first Any specified classpaths are concatenated to the system classpath This is the other form of compromise where the build runner has priority 20 Ant User Manual 5 3 Description 5 3 1 Description Provides a description of the current project 5 3 2 Parameters none 5 3 3 Examples lt description gt This buildfile is used to build the foo subproject within the large complex bar project lt description gt 21 5 3 Description 5 4 PatternSet 5 4 PatternSet p 17 can be grouped to sets and later be referenced by their id attribute They are defined via a patternset element which can appear nested into a FileSet p 25 or a directory based task that consti tutes an implicit FileSet In addition patternsets can be defined as a stand alone element at the same level as target i e as children of project as well as as children of target Patterns can be specified by nested lt include gt or lt exclude gt elements or the following attributes Desc
161. ic No defaults to deployment jar The suffix used to generate the generic jar file is not generic jar particularly important unless it is desired to keep the generic jar file It should not however be the same as the suffix setting String value appended to the basename of the deployment descriptor to No defaults to create the filename of the WebLogic EJB jar file jar This controls whether the generic file used as input to ejbc is retained No defaults to false 7 7 9 6 Weblogic element The weblogic element is used to control the weblogic ejbe compiler for generating weblogic EJB jars Prior to Ant 1 3 the method of locating CMP descriptors was to use the ejbjar naming convention So if your ejb jar was called Customer ejb jar xml your weblogic descriptor was called Customer weblogic ejb jar xml and your CMP descriptor had to be Customer weblogic cmp rdbms jar xml In addition the lt type storage gt element in the weblogic descriptor had to be set to the standard name META INF weblogic cmp rdbms jar xml as that is where the CMP descriptor was mapped to in the generated jar There are a few problems with this scheme It does not allow for more than one CMP descriptor to be defined in a jar and it is not compatible with the deployment descriptors generated by some tools In Ant 1 3 ejbjar parses the weblogic deployment descriptor to discover the CMP descriptors which are then included automat
162. ically This behaviour is controlled by the newCMP attribute Note that if you move to the new method of determining CMP descriptors you will need to update your weblogic deployment descriptor s lt type storage gt element In the above example you would define this as META INF Customer weblogic cmp rdbms jar xml Description Required The base directory into which the generated weblogic ready jar files are Yes deposited Jar files are deposited in directories corresponding to their location within the descriptordir namespace genericjarsuffix A generic jar is generated as an intermediate step in build the weblogic No defaults to deployment jar The suffix used to generate the generic jar file is not generic jar particularly important unless it is desired to keep the generic jar file It should not however be the same as the suffix setting String value appended to the basename of the deployment descriptor to No defaults to create the filename of the WebLogic EJB jar file jar 179 7 7 9 ejbjar The classpath to be used when running the weblogic ejbc tool Note that this tool typically requires the classes that make up the bean to be avail able on the classpath Currently however this will cause the ejbc tool to be run in a separate VM Weblogic 6 0 will give a warning if the home and remote interfaces of a bean are on the system classpath used to run weblogic ejbc In that case the stand
163. ific line separator lt replace file src index html gt lt replacetoken gt lt CDATA two line token gt lt replacetoken gt lt replacevalue gt lt CDATA two line token gt lt replacevalue gt lt replace gt 6 41 5 1 replacefilter In addition to allowing for multiple replacements optional nested lt replacefilter gt elements allow replacement values to be extracted from a property file The name of this file is specified using the lt replace gt attribute propertyFile Description Required The string to search for Yes The replacement string Either may be specified but not both Both Name of the property whose value is to serve as can be omitted if desired the replacement value If neither value nor property is used the value provided using the lt replace gt attribute value and or the lt replacevalue gt element is used If no value was specified using either of these options the token is replaced with an empty string 114 Ant User Manual 6 41 6 Examples 6 41 6 Examples lt replace file configure sh value defaultvalue propertyFile source name properties gt lt replacefilter token tokenl gt lt replacefilter token token2 value value2 gt lt replacefilter token token3 property property key gt lt replace gt In file configure sh replace all instances of tokenl1 with defaultvalue all instances of token2
164. ill modify that recorders state recording or not or other properties like logging level Some technical issues the file s print stream is flushed for finished events buildFinished targetFinished and taskFinished and is closed on a buildFinished event 6 39 2 Parameters Description The name of the file this logger is associated with This tells the logger what to do should it start recording or stop The first time that the recorder task is called for this logfile and if this attribute is not provided then the default for this attribute is start If this attribute is not provided on subsequent calls then the state remains as previous Values startlstop Default no state change Should the recorder append to a file or create a new one This is only applicable the first time this task is called for this file Values yesIno Default yes At what logging level should this recorder instance record to This is not a once only parameter like append is you can increase or decrease the logging level as the build process continues Values errorlwarnlinfolverboseldebug Default no change 6 39 3 Examples The following build xml snippet is an example of how to use the recorder to record just the lt javac gt task lt compile gt lt record name log txt action start gt lt javac lt record name log txt action stop gt lt compile gt 110 Ant User Manua
165. ine regular expressions If the source file name matches the from pattern the target file name will be constructed from the to pattern using 0 to 9 as back references for the full match 0 or the matches of the subexpressions in parentheses Source files not matching the from pattern will be ignored Note that you need to escape a dollar sign with another dollar sign in Ant The regexp mapper needs a supporting library and an implementation of org apache tools ant util regexp RegexpMatcher that hides the specifics of the library Ant comes with implementations for the java utilregex package of JDK http java sun com j2se 1 4 docs api java util regex package summary html http jakarta apache org regexp and http jakarta apache org oro If you compile from sources and plan to use one of them make sure the libraries are in your CLASSPATH For information about using gnu regexp http www cacas org wes java or gnu rex http www crocodile org sts Rex with Ant see this http marc theaims group com l ant devm 97550753813481w 2 article Ant will choose the regular expression library based on the following algorithm If the system property ant regexp matcherimpl has been set it is taken as the name of the class implementing org apache tools ant util regexp RegexpMatcher that should be used If it has not been set first try the JDK 1 4 classes then jakarta ORO and finally try jakarta regexp 30
166. information for testcases that failed while plain gives a little statistics line for all test cases Custom formatters that need to implement org apache tools ant taskdefs optional junit JUnitResultFormatter can be specified Description Required Use a predefined formatter either xml plain or brief Exactly one of these Name of a custom formatter class Extension to append to the output filename Yes if classname has been used Boolean that determines whether output should be sent to a No default true file 216 Ant User Manual 7 16 3 4 test Defines a single test class Description 7 16 3 Nested Elements Required Name of the test class Run the tests in a separate VM Overrides value set in lt junit gt haltonerror Stop the build process if an error occurs during the test run Overrides value set in lt junit gt errorProperty The name of a property to set in the event of an error Overrides value set in lt junit gt haltonfailure Stop the build process if a test fails errors are considered failures as well Overrides value set in lt junit gt failureProperty The name of a property to set in the event of a failure errors are considered failures as well Overrides value set in lt junit gt Directory to write the reports to No default is current direc tory Base name of the test result The full filename is d
167. ing build by Ant it would be better to explicitly add the classpath in the task The task checks timestamps on the JSP s and the generated classes and compiles only those files that have changed It follows the weblogic naming convention of putting classes in _dirName _fileName class for dirname fileName jsp 7 35 0 3 Example lt target name jspcompile depends compile gt lt wljspe src c weblogic myserver public_html dest c weblogic myserver serverclasses package myapp jsp gt lt classpath gt lt pathelement location weblogic classpath gt lt pathelement path compile dest gt lt classpath gt lt wljspe gt lt target gt 260 Ant User Manual 7 35 wljspc 7 35 0 4 Limitations This works only on weblogic 4 5 1 It compiles the files thru the Classic compiler only Since it is my experience that weblogic jspc throws out of memory error on being given too many files at one go it is called multiple times with one jsp file each 261 7 36 XMLValidate 7 36 XMLValidate 7 36 1 Description This task checks xml files are valid or only well formed The task uses crimson SAX2 parser implemen tation by default but one can specify any SAX1 2 parser if needed 7 36 2 Parameters Description the file s you want to check optionally can use an embedded fileset if true only check the xml document is well formed ignored if the specified parser is as SAX1 par
168. install directory dtd directory 184 Ant User Manual 7 7 9 ejbjar lt ejbjar srcdir build classesdir descriptordir S src gt lt iplanet destdir S assemble ejbjar gt classpath S ias ejbc cpath gt lt include name ejb jar xml gt lt exclude name ias xml gt lt dtd publicId Sun Microsystems Inc DTD Enterprise JavaBeans 1 1 EN location ias home APPS ejb jar_1_1 dtd gt lt dtd publicId Sun Microsystems Inc DTID iAS Enterprise JavaBeans 1 0 EN location ias home APPS IASEjb_jar_1_0 dtd gt lt ejbjar gt 185 7 7 10 BorlandGenerateClient 7 7 10 BorlandGenerateClient 7 7 10 1 Description The BorlandGenerateClient is a task dedicated to Borland Application Server v 4 5 It offers to generate the client jar file corresponding to an ejb jar file 7 7 10 2 Parameters Description ejb jar file If true turn on the debug mode for each borland tools java2iiop iastool default false client jar file name If missing the client jar file name is build using the ejbjar file name ejbjar hellobean ejb jar gt hellobean ejbclient jar choose the command launching mode Two values java or fork default java Possibility to specify a classpath 7 7 10 3 Examples The following build xml snippet is an example of how to use Borland element into the ejbjar task using the java mode lt blgenclient ejbjar li
169. ion version is available at http www webgain com products quality_analyzer Though you will not be able to use Metrics from the command line if you do not have a registered version You also need a TRaX compliant processor such as Xalan 2 x http xml apache org xalan j via JAXP 1 1 7 18 2 Description Invokes the Metamata Metrics WebGain Quality Analyzer source code analyzer on a set of Java files mmetrics will compute the metrics of a set of Java files and write the results to an XML file As a conve nience a stylesheet is given in etc directory so that an HTML report can be generated from the XML file 7 18 3 Parameters Attribute Description metamatahome The home directory containing the Metamata distribution The XML were the resulting metrics will be written to Metrics granularity of the source files Must be either files compilation units types types and compilation units or methods methods types and compila tion units Set the maximum memory for the JVM this is a convenient way to set the mx or Xmx argument 7 18 4 Nested elements For specifying the source code to analyze you can either use a path or fileset elements though a single path element is preferred see note below 7 18 4 1 jvmarg Additional parameters may be passed to the VM via nested lt jvmarg gt attributes lt jvmarg gt allows all attributes described in p 14 222 Ant User Manual 7 18 5 Exa
170. ion file if it already exists Behavior to use if no files match 6 28 3 Nested elements 6 28 3 1 metainf The nested met ainf element specifies a p 25 All files included in this fileset will end up in the META INF directory of the jar file If this fileset includes a file named MANIFEST MF the file is ignored and you will get a warning 6 28 4 Examples lt jar jarfile S dist lib app jar basedir build classes gt jars all files in the build classes directory into a file called app jar in the dist lib directory lt jar jarfile S dist lib app jar basedir build classes xcludes Test class gt 81 6 28 4 Examples jars all files in the build classes directory into a file called app jar in the dist lib directory Files with the name Test class are excluded lt jar jarfile S dist lib app jar basedir build classes includes mypackage test xcludes Test class gt jars all files in the build classes directory into a file called app jar in the dist lib directory Only files under the directory mypackage test are used and files with the name Test class are excluded lt jar jarfile S dist lib app jar gt lt fileset dir build classes xcludes Test class lt gt lt fileset dir src resources gt lt jar gt jars all files in the build classes directory and also in the src res
171. ist action ignored otherwise ignoreNoncriticalErrors flag which permits the task to ignore some non fatal error codes sent by some servers during directory creation wu ftp in particular Default false skipFailedTransfers flag which enables unsuccessful file put delete and get operations to be skipped with a warning and the remainder of the files still trans ferred Default false 7 8 3 Sending Files The easiest way to describe how to send files is with a couple of examples lt ftp server ftp apache org userid anonymous password me myorg com gt lt fileset dir htdocs manual gt lt ftp gt Logs in to ftp apache org as anonymous and uploads all files in the htdocs manual directory to the default directory for that user 190 Ant User Manual 7 8 4 Getting Files lt ftp server ftp apache org remotedir incoming userid anonymous password me myorg com depends yes lt fileset dir htdocs manual gt lt ftp gt Logs in to ftp apache org as anonymous and uploads all new or changed files in the htdocs manual directory to the incoming directory relative to the default directory for anony mous lt ftp server ftp apache org port 2121 remotedir pub incoming userid coder password Jjaval depends yes binary no lt fileset dir htdocs manual gt lt include name html gt lt fileset gt lt ftp gt Logs in to ftp apache org at port 2121 as co
172. it does anything the Windows batch file invokes SHOME antrc_pre bat at the start and SHOME S antrc_post bat at the end You can use these files to set unset environment variables that should only be visible during the execution of Ant See the next section for example 3 0 3 Environment Variables The wrapper scripts use the following environment variables if set JAVACMD full path of the Java executable Use this to invoke a different JVM than JAVA_HOME bin java exe ANT_OPTS command line arguments that should be passed to the JVM for example you can define properties or set the maximum Java heap size here 3 1 Running Ant by Hand If you have installed Ant in the do it yourself way Ant can be started with java Dant home c ant org apache tools ant Main options target These instructions actually do exactly the same as the ant command The options and target are the same as when running Ant with the ant command This example assumes you have set your classpath to include ant jar jars classes for your XML parser the JDK s required jar zip files Ant User Manual 4 Using Ant 4 Using Ant 4 1 Writing a Simple Buildfile Ant s buildfiles are written in XML Each buildfile contains one project Each task element of the buildfile can have an id attribute and can later be referred to by the value supplied to this The value has to be unique For additional information see the p 10 section bel
173. ithout any command line arguments the directory in which the command should be executed No list of Operating Systems on which the command may be executed If the current OS s name is contained in this list the command will be executed The OS s name is determined by the Java Virtual machine and is set in the os name system property output the file to which the output of the command should be redirected outputproperty the name of a property in which the output of the command should be stored Stop the command if it doesn t finish within the specified time given in milliseconds Stop the buildprocess if the command exits with a returncode other than 0 Defaults to false newenvironment Do not propagate old environment when new environment variables are No default specified is false vmlauncher Run command using the Java VM s execution facilities where available If No default set to false the underlying OS s shell either directly or through the antRun is true scripts will be used Under some operating systems this gives access to facilities not nomrally available through the VM including under Windows being able to execute scripts rather than their associated inter preter 6 20 3 Examples lt exec dir src executable cmd exe os Windows 2000 output dir txt gt lt arg line c dir gt lt exec gt 68 Ant User Manual 6 20 4 Parameters specifie
174. jdbc database url userid sa password pass gt insert into table some_table values 1 2 3 4 truncate table some_other_table lt sql gt Connects to the database given in url as the sa user using the org database jdbcDriver and executes the two SQL statements inserting data into some_table and truncating some_other_table 123 6 46 4 Examples Note that you may want to enclose your statements in lt CDATA gt sections so you don t need to escape lt gt amp or other special characters For example lt sql driver org database jdbcDriver url jdbc database url userid sa password pass gt lt CDATA update some_table set columnl columnl 1 where column2 lt 42 gt lt sql gt The following connects to the database given in url as the sa user using the org database jdbcDriver and executes the SQL statements contained within the files datal sql data2 sql and data3 sql and then executes the truncate operation on some_other_table lt sql driver org database jdbcDriver url jdbc database url userid sa password pass gt lt transaction src datal sql gt lt transaction src data2 sql gt lt transaction src data3 sql gt lt transaction gt truncate table some_other_table lt transaction gt lt sql gt The following connects to the database given in url as the sa user using the org database jdbcDriver and executes the SQL statements contained
175. ken to be an include pattern Whether the file being renamed to should be replaced if it already exists The starting directory for files to search in toExtension The string that renamed files will end with on completion 7 27 4 Examples lt renameext srcDir source projectl includes excludes samples fromExtension java keep toExten sion java replace true gt 248 Ant User Manual 7 28 Rom 7 28 Rpm 7 28 1 Description A basic task for invoking the rpm executable to build a linux installation file The task currently only works on Linux 7 28 2 Parameters Description The name of the spec File to be used this is the directory which will have the expected subdirectories SPECS SOURCES BUILD SRPMS If this isn t specified the baseDir value is used his will remove the generated files in the BUILD directory this will remove the spec file from SPECS very similar idea to the cvs task the default is bb where standard output and error go 249 7 29 Script 7 29 Script 7 29 1 Description Execute a script in a http oss software ibm com developerworks opensource bsf supported language Note This task depends on external libraries not included in the Ant distribution See Library Dependen p 5 for more information All items tasks targets etc of the running project are accessible from the script usi
176. l 6 30 3 Parameters specified as nested elements depend enables dependency tracking for compilers that support this jikes and classic includeAntRuntime whether to include the Ant run time libraries defaults to yes includeJavaRuntime whether to include the default run time libraries from the executing VM defaults to no fork whether to execute Javac using the JDK compiler externally defaults to no memorylInitialSize the initial size of the memory for the underlying VM if javac is run externally ignored otherwise defaults to the standard VM memory setting examples 83886080 81920k or 80m memoryMaximumSize the maximum size of the memory for the underlying VM if javac is run externally ignored otherwise defaults to the standard VM memory setting examples 83886080 81920k or 80m failonerror indicates whether the build will continue even if there are compilation errors defaults to t rue 6 30 3 Parameters specified as nested elements This task forms an implicit p 25 and supports all attributes of lt fileset gt dir becomes srcdir as well as the nested lt include gt lt exclude gt and lt patternset gt elements 6 30 3 1 src classpath bootclasspath and extdirs Javac s srcdir classpath bootclasspath and extdirs attributes are p 13 and can also be set via nested lt srcgt lt classpathgt lt bootclasspathgt and lt extdirsgt elements respectively 6
177. l 6 39 4 Notes The following two calls to lt record gt set up two recorders one to file records simple log at logging level info the default and one to file SO log using logging level of verbose lt record name records simple log gt lt record name ISO log loglevel verbose gt 6 39 4 Notes There is some functionality that I would like to be able to add in the future They include things like the following Attribute Description messageprefix Whether or not to include the message prefixes things like the name of the tasks or targets etc This has the same effect as the emacs command line parameter does to the screen output yeslno A classname of a build listener to use from this point on instead of the default listener A comma separated list of targets to automatically record If this value is all then all targets are recorded Default all A comma separated list of task to automatically record or not This could be difficult as it could conflict with the includetarget excludetarget excludetask e g includetarget compile exlcudetask javac what should happen action add greater flexibility to the action attribute Things like close to close the print stream 111 6 40 Rename 6 40 Rename 6 40 1 Deprecated This task has been deprecated Use the Move task instead 6 40 2 Description Renames a given file 6 40 3 Parameters Description
178. lasses d weblogic mssqlserver4 classes c WINNT SYSTEM32 6 37 4 5 Example 5 lt fileset dir S srce dir id src files gt lt include name java gt lt fileset gt lt pathconvert pathsep property javafiles refid srce files gt This example takes the set of files determined by the fileset all files ending in java joins them together separated by commas and places the resulting list into the property javafiles The directory separator is not specified so it defaults to the appropriate character for the current platform Such a list could then be used in another task like javadoc that requires a comma separated list of files 106 Ant User Manual 6 38 Property 6 38 Property 6 38 1 Description Sets a property by name and value or set of properties from file or resource in the project When a property was set by the user or was a property in a parent project that started this project with the p 37 then this property cannot be set and will be ignored This means that properties set outside the current project always override the properties of the current project There are five ways to set properties By supplying both the name and value attribute By supplying both the name and refid attribute By setting the file attribute with the filename of the property file to load This property file has the format as defined by the file used in the class java util Properties By settin
179. lays a for every 100 Kb retrieved This task should be preferred above the CVS task p 57 when doing automated builds CVS is signifi cantly slower than loading a compressed archive with http ftp The usetimestamp option enables you to control downloads so that the remote file is only fetched if newer than the local copy If there is no local copy the download always takes place When a file is downloaded the timestamp of the downloaded file is set to the remote timestamp if the JVM is Javal 2 or later NB This timestamp facility only works on downloads using the HTTP protocol 6 25 2 Parameters Description the URL from which to retrieve a file the file where to store the retrieved file show verbose progress information on off Log errors but don t treat as fatal usetimestamp conditionally download a file based on the timestamp of the local copy HTTP only 6 25 3 Examples lt get src http jakarta apache org dest help index htm1 gt Gets the index page of http jakarta apache org and stores it in the file he lp index html lt get src http jakarta apache org builds tomcat nightly ant zip dest optional jar verbose true usetimestamp true gt Gets the nightly ant build from the tomcat distribution if the local copy is missing or out of date Uses the verbose option for progress information 77 6 26 GUnzip 6 26 GUnzip 6 26 1 Description
180. ld be used with text files only 4 1 8 Path like Structures You can specify PATH and CLASSPATH type references using both and as separator characters Ant will convert the separator to the correct character of the current operating system Wherever path like values need to be specified a nested element can be used This takes the general form of lt classpath gt lt pathelement path classpath gt lt pathelement location lib helper jar gt lt classpath gt The Location attribute specifies a single file or directory relative to the project s base directory or an absolute filename while the path attribute accepts colon or semicolon separated lists of locations The path attribute is intended to be used with predefined paths in any other case multiple elements with location attributes should be preferred As a shortcut the lt classpath gt tag supports path and Location attributes of its own so lt classpath gt lt pathelement path classpath gt lt classpath gt can be abbreviated to lt classpath path S classpath gt In addition p 25 s can be specified via nested lt fileset gt elements The order in which the files building up a fileset are added to the path like structure is not defined lt classpath gt lt pathelement path classpath gt lt fileset dir lib gt lt include name jar gt lt fileset gt lt pathelement location classes gt lt classpa
181. le under analysis ends with htm or html No default is false seedname Seed name for the temporary snapshot files files will be named seed jpc seed1 jpc seed2 jpc No default to snapshot exitprompt Toggles display of the console prompt Press Enter to close this window always Always displays the prompt never Never displays the prompt error Only displays prompt after an error No default is never finalsnapshot Type of snapshot to send at program termination Must be one of none coverage all No default to coverage recordfromstart n Must be one of coverage all none If you want Coverage to start analyzing as soon as the program begins to run use all If not select none No default to coverage warnlevel Set warning level 0 3 where 0 is the least amount of warnings No default to 0 snapshotdir The path to the directory where snapshot files are stored Choose a direc tory that is reachable by both the remote and local computers and enter the same path on the command line and in the viewer No default to current direc tory workingdir The physical path to the working directory for the VM No default is current direc tory tracknatives Test native methods Note that testing native methods with Java 2 disables the JIT No default to false classname the name of the class to analyze
182. lement is used to supply additional classes files to be included in the generated jars The lt support gt element is a FileSet so it can either reference a fileset declared elsewhere or it can be defined in place with the appropriate lt include gt and lt exclude gt nested elements The files in the support fileset are added into the generated EJB jar in the same relative location as their location within the support fileset Note that when ejbjar generates more than one jar file the support files are added to each one 7 7 9 4 Vendor specific deployment elements Each vendor specific nested element controls the generation of a deployable jar specific to that vendor s EJB container The parameters for each supported deployment element are detailed here 7 7 9 5 Jboss element The jboss element searches for the jboss specific deployment descriptors and adds them to the final ejb jar file Jboss has two deployment descriptors jboss xml and jaws xml for container manager persistance only The Jboss server uses hot deployment and does not require compilation of additional stubs and skeletons 178 Ant User Manual 7 7 9 ejbjar Description Required The base directory into which the generated weblogic ready jar files Yes are deposited Jar files are deposited in directories corresponding to their location within the descriptordir namespace genericjarsuffix A generic jar is generated as an intermediate step in build the weblog
183. lt lib gt lt classes dir build main gt lt zipfileset dir src graphics images gifs prefix images gt lt war gt will consist of 144 META INF directory of the war file If this fileset includes a file named MANT F EST MF the file is Ant User Manual 6 58 4 Examples WEB INF web xml WEB INF 1lib jdbc2 jar WEB INF classes com myco myapp Servlet class META INF MANIFEST ME index html front jsp images small logo gif images large logo gif using Ant s default manifest file The content of WEB INF web xml is identical to src meta data myapp xml 145 6 59 Zip 6 59 Zip 6 59 1 Description Creates a zipfile The basedir attribute is the reference directory from where to zip Note that file permissions will not be stored in the resulting zipfile It is possible to refine the set of files that are being zipped This can be done with the includes includes file excludes excludesfile and defaultexcludes attributes With the includes or includesfile attribute you specify the files you want to have included by using patterns The exclude or excludesfile attribute is used to specify the files you want to have excluded This is also done with patterns And finally with the defaul texcludes attribute you can specify whether you want to use default exclusions or not See the section on directory based tasks p 17 on how the inclusion exclusion of files works and how to
184. lusion and exclusion you have a powerful way to select just the files you want 5 1 2 Examples lt copy todir dist gt lt fileset dir S src includes images excludes gif gt lt copy gt 18 Ant User Manual 5 1 3 Default Excludes This copies all files in directories called images that are located in the directory tree defined by src to the destination directory defined by dist but excludes all gif files from the copy This example can also be expressed using nested elements lt copy todir dist gt lt fileset dir S src gt lt include name images gt lt exclude name gif gt lt fileset gt lt copy gt 5 1 3 Default Excludes There are a set of definitions that are excluded by default from all directory based tasks They are K L KW ERS EX HE ERS cae ax SKS CVS x CVS cvsignore SCCS EX SCCS VSSVeEr SCC If you do not want these default excludes applied you may disable them with the defaultex cludes no attribute 5 2 build sysclasspath 5 2 build sysclasspath The value of the build sysclasspath property control how the system classpath ie the classpath in effect when Ant is run affects the behaviour of classpaths in Ant The default behavior varies from Ant to Ant task The values and their meanings are only Only the system classpath is used and classpaths specified in build files etc are ignored T
185. ly supported by the CSharp task warnaserror basead dress 0x 12840000 failOnError Should a failed compile halt the build true default or false print the full path of files on on errors comma separated list of patterns of files that must be included All files are included when omitted includeDefaultReferences Flag which when true automatically includes the common assemblies in dotnet betal and tells the compiler to link in mscore dll true default or false includesfile the name of a file Each line of this file is taken to be an include pattern incremental Incremental build flag Avoid till it works true or false default name of main class for executables com example project entrypoint a flag which tells the compiler not to read in the compiler settings files csc rsp in its bin directory and then the local direc tory true or false default optimisation flag true or false default filename of output 153 example exe 7 1 10 Task ilasm Semicolon separated list of dlls to refer to mylib dll nunit dll Ant Path descriptioon of references to include Wildcards should work source directory default project direc tory Type of target exe module library winexe or unsafe enable the unsafe keyword true or false default utf8output require all compiler
186. ly the S commands http www cvshome org docs manual cvs_16 html 58 Ant User Manual 6 13 cvspass 6 13 cvspass 6 13 1 Description Adds entries to a cvspass file Adding entries to this file has the same affect as a cvs login command 6 13 2 Parameters Description Required the CVS repository to add an entry for Yes Password to be added to the password file Yes Password file to add the entry to No default is cvspass 6 13 3 Examples lt cvspass cvsroot pserver anoncvs jakarta apache org home cvspublic password anoncvs gt Adds an entry into the cvspass password file 59 6 14 Delete 6 14 Delete 6 14 1 Description Deletes either a single file all files in a specified directory and its sub directories or a set of files specified by one or more p 25 s When specifying a set of files empty directories are not removed by default To remove empty directories use the includeEmptyDirs atribute 6 14 2 Parameters Description Required The file to delete at least one The directory to delete files from of the two Show name of each deleted file true false Default is false when omitted If the file does not exist do not display a diagnostic message or modify the exit status to reflect an error unless Ant has been invoked with the verbose or debug switches This means that if a file or directory cannot be deleted then no error is r
187. me mssqlserver4 classes gt lt pathelement location c winnt System32 gt lt path gt lt pathconvert gt This generates the exact same path as the previous example It demonstrates the use of a nested path element 105 6 37 4 Examples 6 37 4 3 Example 3 lt pathconvert targetos unix property newpath refid wl path gt lt map from d to foo gt lt map from c to bar gt lt pathconvert gt This example specifies two map entries that will convert path elements that start with c to dos and d to The resulting path is shown below weblogic lib weblogicaux jar weblogic classes weblogic mssqlserver4 classes dos WINNT SYSTEM32 6 37 4 4 Example 4 lt pathconvert targetos windows property newpath gt lt path id wl path gt lt pathelement location wl home lib weblogicaux jar gt lt pathelement location wl home classes gt lt pathelement location wl home mssqlserver4 classes gt lt pathelement location dos winnt System32 gt lt path gt lt map from dos to c gt lt map from to d gt lt pathconvert gt This example similar to the one above but targetting windows specifies two map entries that will convert path elements that start with dos to c and to d Note that the order of the map elements was important here since is a prefix of dos The resulting path is shown below d weblogic lib weblogicaux jar d weblogic c
188. mpilation times to the console Turns on or off tracing and directs the resultant trace output Tells the NetRexx compiler that the source is in UTF8 Whether lots of warnings and error messages should be generated 232 Ant User Manual 7 23 3 Examples 7 23 3 Examples lt netrexxc srcDir source project includes vnr util destDir source project build class path source project2 proj jar comments true replace true keep true gt crossref false 233 7 24 Perforce Tasks User Manual 7 24 Perforce Tasks User Manual by Les Hughes leslie hughes rubus com Kirk Wylie kirk radik com Version 1 1 2001 01 09 7 24 1 Contents e iniroduction p 234 The Tasks p 234 Change History p 240 7 24 2 Introduction These tasks provide an interface to the http www perforce com SCM The org apache tools ant taskdefs optional perforce package consists of a simple frame work to support p4 functionality as well as some Ant tasks encapsulating frequently used by me p4 commands However the addition of new p4 commands is a pretty simple task see the source Although it is possible to use these commands on the desktop they were primarily intended to be used by automated build systems Note These tasks require the joro 2 0 XXX http jakarta apache org oro regular expression package Simply download this package and copy the jakarta oro 2 0 XXX jar
189. mple 7 18 4 2 classpath Sets class path also source path unless one explicitly set Overrides METAPATH CLASSPATH environ ment variables The classpath element represents a PATH like structure p 13 7 18 4 3 sourcepath Sets source path Overrides the SOURCEPATH environment variable The sourcepath element repre sents a PATH like structure p 13 7 18 4 4 path Sets the list of directories to analyze the code for metrics It represents a PATH structure p 13 7 18 4 5 fileset Sets a set of files to analyze for metrics source It represents a FILESET structure p 25 Note For the sake of readability it is highly recommended to analyze for a single unique directory instead than using filesets or several directories Otherwise there will be multiple metrics outputs without any way to know what metrics refers to what source Chance are also that the XML handler that does some heuris tic will be confused by the different outputs 7 18 5 Example lt mmetrics target mmetrics xml metamatahome c metamata granularity methods gt lt classpath gt lt pathelement location c metamata examples metricsexamples gt lt classpath gt lt sourcepath gt lt pathelement location c metamata examples metricsexamples gt lt sourcepath gt lt path gt lt pathelement location c metamata examples metricsexamples gt lt path gt lt mmetrics gt This invokes Metamata Metrics installed in c metamata on t
190. n exclude pattern defaultexcludes indicates whether default excludes should be used or not yes no Default excludes are used when omitted check that classes implement Remote before handing them to rmic default is false indicates that portable RMI IIOP stubs should be generated additional arguments for IIOP class generation indicates that IDL output files should be generated additional arguments for IDL file generation generate debug info passes g to rmic Defaults to false includeAntRuntime whether to include the Ant run time libraries defaults to yes includeJavaRuntime whether to include the default run time libraries from the executing VM defaults to no extdirs location of installed extensions 6 42 3 Parameters specified as nested elements 6 42 3 1 classpath and extdirs Rmic s classpath and extdirs attributes are p 13 and can also be set via a nested classpath and extdirs elements 117 6 42 4 Examples 6 42 4 Examples lt rmic classname com xyz FooBar base build classes gt runs the rmic compiler for the class com xyz FooBar The compiled files will be stored in the direc tory build classes lt rmic base build classes includes Remote class gt runs the rmic compiler for all classes with class files below build classes whose classname starts with Remote The compiled files will be stored in the directory
191. n is applied path to the ccm executable file required if it is not on the PATH 7 5 4 3 Examples lt ccemreconfigure ccmproject ANTCCM_TEST BMO_1 verbose true gt Does a Continuus reconfigure on the project ANTCCM_TEST BMO_1 7 5 5 CCMCreateTask 7 5 5 1 Description Create a Continuus task 7 5 5 2 Parameters Attribute Specify a comment Specify the target platform path to the ccm executable file required if it is not on the PATH Specify the resolver Specify the CCM release Specify the subsystem Specify the task number used to checkin the file may use default 7 5 5 3 Examples lt ccmcreatetask resolver user name release ANTCCM_TEST comment blahblah gt Creates a task for the release ANTCCM_TEST with the current user as the resolver for this task 164 Ant User Manual 7 6 Depend 7 6 Depend A task to manage Java class file dependencies 7 6 1 Description The depend task works by determining which classes are out of date with respect to their source and then removing the class files of any other classes which depend on the out of date classes To determine the class dependencies the depend task analyses the class files of all class files passed to it Depend does not parse your source code in any way but relies upon the class references encoded into the class files by the compiler This is generally faster than par
192. n test sources gt lt fileset gt Groups all files in directory client src using the same patterns as the example above 25 5 7 Filterset 5 7 Filterset FilterSets are groups of filters Filters can be defined as token value pairs or be read in from a file Filter Sets can appear inside tasks that support this feature or at the same level as target i e as children of project In addition Filtersets can have begintoken and or endtoken attributes to define what to match Filtersets are used for doing replacements in tasks like copy etc 5 8 Filterset Description Default The string marking the beginning of a token eg Date The string marking the end of a token eg Date Description The token to replace eg Date The value to replace it with eg Thursday April 26 2001 5 10 0 1 Examples You are copying the version txt file to the dist directory from the build directory but wish to replace the token DATE with todays date lt copy file build home version txt toFile dist home version txt lt lt filterset gt lt filter token DATE value DATE gt lt filterset gt lt copy gt You are copying the version txt file to the dist directory from the build directory but wish to replace the token DATE with todays date lt copy file build home version txt toFile dist home version txt gt lt filterset begintoken endtoken
193. n the current project njai 141 Unzips a jarfile Untar fp 139 Untars a tarfile awanip 141 Unzips a warfile Cnziplip 141 Unzips a zipfile Uprodatelip 1421 Sets a property if a target files are more up to date than a set of Source files 35 6 1 Overview of Ant core tasks p 143 An extension of the Jar p 80 task with special treatment for files that should end up in the WEB INF 1ib WEB INF classes or WEB INF directories of the Web Application Archive Zip p 146 Creates a zipfile 36 Ant User Manual 6 2 Ant 6 2 Ant 6 2 1 Description Runs Ant on a supplied buildfile This can be used to build subprojects When the antfile attribute is omitted the file build xml in the supplied directory dir attribute is used If no target attribute is supplied the default target of the new project is used By default all of the properties of the current project will be available in the new project Alternatively you can set the inheritAll attribute to false and only user properties i e those passed on the command line will be passed to the new project In either case the set of properties passed to the new project will override the properties that are set in the new project See also the property task p 107 You can also set properties in the new project from the old project by using nested property tags These propertie
194. name attribute the resource name of the property file the filename of the property file environment the prefix to use when retrieving environment variables Thus if you specify environment myenv you will be able to access OS specific environment variables via property names myenv PATH or myenvy TERM Note that if you supply a property name with a final it will not be doubled ie environ ment myenv will still allow access of environment variables through myenv PATH and myenv TERM This functionality is currently only implemented on select platforms Feel free to send patches to increase the number of platforms this functionality is supported on One of these when not using the name attribute the classpath to use when looking up a resource the classpath to use when looking up a resource given as reference p 15 to a PATH defined elsewhere 6 38 3 Parameters specified as nested elements 6 38 3 1 classpath Property s classpath attribute is a PATH like structure p 13 and can also be set via a nested classpath element 6 38 4 Examples lt property name foo dist value dist gt sets the property foo dist to the value dist lt property file foo properties gt reads a set of properties from a file called foo properties lt property resource foo properties gt 108 Ant User Manual 6 38 4 Examples reads a set of properties from a resou
195. named last clean build to the output stream lt p4counter name last clean build gt Set the value of the counter based on the value of the T STAMP property lt p4counter name last clean build value S TSTAMP gt Set the value of the p4 last clean build property to the current value of the last clean build counter lt p4counter name last clean build property S p4 last clean build gt 7 24 12 P4Reopen 7 24 12 1 Description Move or reopen in Perforce speak checkout files between changelists 7 24 12 2 Parameters Attribute Description Required tochange The changelist to move files to Yes 7 24 12 3 Examples Move all open files to the default changelist lt p4reopen view tochange default gt Create a new changelist then reopen into it any files from the view projects foo main lt p4change description Move files out of the way gt lt p4reopen view projects foo main tochange p4 change gt 239 7 24 13 P4Revert 7 24 13 P4Revert 7 24 13 1 Description Reverts files 7 24 13 2 Parameters Description The changelist to revert Revert only unchanged files p4 revert a 7 24 13 3 Examples Revert everything lt p4revert view gt Revert any unchanged files in the default change lt p4revert change default revertonlyunchanged true gt 7 24 14 Change History Internal Release within Rubu
196. ncludes the diff output Yes the file to patch No tries to guess it from the diff file Keep backups of the unpatched files Work silently unless an error occurs Assume patch was created with old and new files swapped ignorewhitespace Ignore whitespace differences strip Strip the smallest prefix containing num leading slashes from filenames 6 36 3 Examples lt patch patchfile module 1 0 1 1 patch gt applies the diff included in module 1 0 1 1 patch to the files in base directory guessing the filename s from the diff output lt patch patchfile module 1 0 1 1 patch strip 1 gt like above but one leading directory part will be removed i e if the diff output looked like a mod1l 0 A Mon Jun 5 17 28 41 2000 a mod1 1 A Mon Jun 5 17 28 49 2000 the leading a will be stripped 103 6 37 Pathconvert 6 37 Pathconvert 6 37 1 Description Converts a nested path path reference or fileset reference to the form usable on a specified platform and stores the result in a given property This operation is useful when script files batch files or shell scripts must be generated my the build system and they contain path information that must be properly formatted for the target architecture not the architecture on which the build is running or when you need to create a list of files separated by a given character like a comma or a space Prefix maps can be specified
197. nden cies p 5 for more information The ftp task makes no attempt to determine what file system syntax is required by the remote server and defaults to Unix standards remotedir must be specified in the exact syntax required by the ftp server If the usual Unix conventions are not supported by the server separator can be used to set the file separator that should be used instead See the section on directory based tasks p 17 on how the inclusion exclusion of files works and how to write patterns 7 8 2 Parameters 189 7 8 3 Sending Files Description the address of the remote ftp server the port number of the remote ftp server Defaults to port 21 the login id to use on the ftp server the login password to use on the ftp server the directory to which to upload files on the ftp server the ftp action to perform defaulting to send Currently supports put get del list and mkdir selects binary mode yes or text mode no transfers Defaults to yes selects passive mode yes transfers Defaults to no displays information on each file transferred if set to yes Defaults to no transfers only new or changed files if set to yes Defaults to no newer a synonym for depends separator sets the file separator used on the ftp server Defaults to listing the file to write results of the list action Required for the l
198. ndows and a new DOS window pops up for every use of an external compiler this may be a problem of the JDK you are using This problem may occur with all JDKs lt 1 2 Note If you wish to compile only source files located in some packages below a common root you should not include these packages in the srcdir attribute Use include exclude attributes or elements to filter for these packages If you include part of your package structure inside the srcdir attribute or nested src elements Ant will start to recompile your sources every time you call it 6 30 5 Jikes Notes If the environment variable JIKES_HOME is set to the location of the jikes compiler then the standard Ant invocation scripts automatically set build compiler to jikes This enables one to use jikes when available without having to commit the build file to a single choice of compiler Jikes also supports some extra options which can be set be defining properties prior to invoking the task The ant developers are aware that this is ugly and inflexible expect a better solution in the future All the options are boolean and must be set to true or yes to be interpreted as anything other than false by default build compiler warnings is true while all others are false 88 Ant User Manual build compiler emacs 6 30 5 Jikes Notes Enable emacs compatible error messages build compiler warnings This property has been deprecated use the nowarn
199. ng either their name or id attributes Scripts can do almost anything a task written in Java could do 7 29 2 Parameters Description The programming language the script is written in Must be a supported BSF language The location of the script as a file if not inline 7 29 3 Examples lt project name squares default main basedir gt lt target name Setup gt lt script language jJavascript gt lt CDATA for i l i lt 10 i cho squares createTask echo main addTask echo cho setMessage i i gt lt script gt lt target gt lt target name main depends setup gt lt project gt generates 250 Ant User Manual setup main 1 4 9 16 25 36 49 64 81 100 BUILD SUCCESSFUL Another example using p 15 and two different scripting languages lt project name testscript default main gt lt target name sub gt lt echo id theEcho gt lt target gt lt target name sub1 gt lt script language netrexx gt lt CDATA theEcho setMessage In subl sub execute gt lt script gt lt target gt lt target name sub2 gt lt script language javascript gt lt CDATA theEcho setMessage In sub2 sub execute gt lt script gt lt target gt lt target name main depends sub1 sub2 gt lt project gt generates subl In subl sub2 In sub2 main BUILD SU
200. ng file in the directory src tests a test is run in a separate VM If a test fails the build process is aborted Results are collected in files named TEST name txt and written to S reports tests By using the errorProperty and failureProperty tags it is possible to perform setup work such as starting an external server execute the test clean up and still fail the build in the event of a failure 219 7 17 JUnitReport 7 17 JUnitReport Merge the individual XML files generated by the JUnit task and eventually apply a stylesheet on the resulting merged document to provide a browsable report of the testcases results 7 17 1 Requirements The task will run with either http xml apache org xalan j or Xalan 1 2 2 http xml apache org dist xalan j old xalan j_1_2_2 zip Note For a framed format Xalan 1 2 2 will need Xerces xerces jar as well as BSF bsf jar that can be found in the distribution archive Xerces will need to be before any other parser such as the shipped crimson It is highly recommended to use Xalan2 instead because Xalanl is no more supported 7 17 2 Parameters Description Required The name of the XML file that will aggregate all individual No Default to TESTS Test XML testsuite previously generated by the JUnit task Suites xml The directory where should be written the file resulting from No Default to current direc the individual XML testsuite aggregation tory 7 17 3 Ne
201. nt headers for result sets from the statements No default true default true output Output file for result sets defaults to System out No print to System out by default classpath Classpath used to load driver No use system classpath onerror Action to perform when statement fails continue No default abort stop abort rdbms Execute task only if this rdbms No no restriction Execute task only if rdbms version match No no restriction 122 Ant User Manual 6 46 3 Parameters specified as nested elements 6 46 3 Parameters specified as nested elements 6 46 3 1 transaction Use nested lt t ransaction gt elements to specify multiple blocks of commands to the executed executed in the same connection but different transactions This is particularly useful when there are multiple files to execute on the same schema Required Yes unless statements enclosed within tags 6 46 3 2 classpath Sql s classpath attribute is a PATH like structure p 13 and can also be set via a nested classpath element It is used to load the JDBC classes The 6 46 4 Examples lt sql driver org database jdbcDriver url jdbc database url userid sa password pass src data sql gt Connects to the database given in url as the sa user using the org database jdbcDriver and executes the SQL statements contained within the file data sql lt sql driver org database jdbcDriver url
202. ocation to store the exported files exportSources export source files default yes exportResources export resource files default yes exportClasses export class files default no exportDebugInfo include debug info in exported class files default no defaultexcludes use default excludes when exporting default yes 8 5 5 3 Parameters specified as nested elements 8 5 5 3 1 include specifies the packages to include into the export name of the VAJ project and package to export The first element of the name must be the project name then the package name elements separated by 8 5 5 3 2 exclude specifies the packages to exclude from the export Attribute Description Required name name of the VAJ project package not to export yes 8 5 5 4 Example lt vajexport destdir srce dir exportResources no gt lt include name MyProject gt lt exclude name MyProject test gt lt vajexport gt This example exports all packages in the VAJ project MyProject except packages starting with test 268 Ant User Manual 8 5 6 VAJImport 8 5 5 5 Default Excludes The default excludes are IBM Java class libraries Sun class libraries JSP Page Compile Generated Code VisualAge 8 5 6 VAJImport 8 5 6 1 Description Imports Java source files class files and or resources from the file system into VAJ Th
203. of every corresponding source file The default behavior is to use almerge mapper p 29 with the to attribute set to the value of the targetfile attribute Normally this task is used to set properties that are useful to avoid target execution depending on the rela tive age of the specified files 6 57 2 Parameters Description Required the name of the property to set Yes the value to set the property to Defaults to No true the file for which we want to determine the Yes unless a nested mapper element is status present 6 57 3 Examples lt uptodate property xmlBuild notRequired targetfile deploy xmlClasses jar gt lt srcfiles dir src xml includes dtd gt lt uptodate gt sets the property xm1Build notRequired to the value true if the deploy xmlClasses jar is more up to date than any of the DTD files in the src xml directory This can be written as lt uptodate property xmlBuild notRequired gt lt srcfiles dir src xml includes dtd gt lt mapper type merge to S deploy xmlClasses jar gt lt uptodate gt as well 142 Ant User Manual 6 58 War 6 58 War 6 58 1 Description An extension of the p 80 task with special treatment for files that should end up in the WEB INF 1ib WEB INF classes or WEB INF directories of the Web Application Archive The War task is a shortcut for specifying the par
204. omitted useexternalfile indicates whether the sourcefile name speci fied in srcfiles or as nested source elements should be written to a temporary file to make the command line shorter Also applies to the package names specified via the package names attribute or nested package elements yes no Default is no 6 31 2 1 Format of the group attribute The arguments are comma delimited Each single argument is 2 space delimited strings where the first one is the group s title and the second one a colon delimited list of packages If you need to specify more than one group or a group whose title contains a comma or a space character using ested group elements p 95 is highly recommended E g group XSLT_Packages org apache xalan xslt XPath_Packages org apache xalan xpath 6 31 3 Parameters specified as nested elements 6 31 3 1 package Same as one entry in the list given by packagenames 6 31 3 1 1 Parameters Attribute Description Required name The package name may be a wildcard Yes 6 31 3 2 excludepackage Same as one entry in the list given by excludepackagenames 6 31 3 2 1 Parameters Same as for package 93 6 31 3 Parameters specified as nested elements 6 31 3 3 source Same as one entry in the list given by sourcefiles 6 31 3 3 1 Parameters Attribute Description Required file The source file to document Yes 6 31 3 4 doctitle Same as the doctitle attribute bu
205. ontains the following elements A menubar with some options described later The name of your selected VAJ project An entry field for the Ant XML buildfile with a browse button The full qualified filename including the directory is needed here e A list with tasks specified in the buildfile Until your first save of the build info described later this list will be empty When loading a build file by the Reload Project button this list is filled with all tasks which have a description attribute The task you select in this list will be executed when press ing the Execute Task button A pulldown box for specifying the log level Three buttons Two of them I have already described and the third one is just the Close button to exit our small tool After you have set up your buildprocess you might find it useful to save the data you ve just entered so we implemented an option to save it to the repository into your selected project Make sure that you have an open edition of your project before selecting Save BuildInfo To Repository from the File menu Now your information is saved to this edition of your project and will be loaded automatically the next time you start Ant Build If you have closed the log window accidentally it can be reopened with the Log item in the File menu and if you want to know who developed this just select About in the Help menu 8 5 11 Frequently Asked Questions Q I want to load export and b
206. ording to the location of the deployment descriptor within the descriptor dir hierarchy 7 7 9 3 Nested Elements In addition to the vendor specific nested elements the ejbjar task provides three nested elements 177 7 7 9 ejbjar 7 7 9 3 1 Classpath The lt classpath gt nested element allows the classpath to be set It is useful when setting the classpath from a reference path In all other respects the behaviour is the same as the classpath attribute 7 7 9 3 2 dtd The lt dtd gt element is used to specify the local location of DTDs to be used when parsing the EJB deploy ment descriptor Using a local DTD is much faster than loading the DTD across the net If you are running ejbjar behind a firewall you may not even be able to access the remote DTD The supported vendor specific nested elements know the location of the required DTDs within the vendor class hierarchy and in general this means lt dtd gt elements are not required It does mean however that the vendor s class hierarchy must be available in the classpath when Ant is started If your want to run Ant without requiring the vendor classes in the classpath you would need to use a lt dtd gt element Description The public Id of the DTD for which the location is being provided The location of the local copy of the DTD This can either be a file or a resource loadable from the classpath 7 7 9 3 3 Support The lt support gt nested e
207. orking if when non Win32 net build tools appear 7 1 7 Using Ant in net projects To use the net tasks one needs A Windows box or any other platform which supports the net build tools JavaVM Javal 1 or later Javal 3 recommended Ant downloaded and the environment and path variables set up so that typing ant invokes ant via a batch file An XML parser for ant The usual distributions include an appropriate version crimson jar and jaxp jar the net tasks archive dotnettasks jar included in the ant lib directory The net sdk installed with the binaries on the path Test type CSC A build xml file to describe the build process 7 1 8 Change Log 7 1 8 0 1 Version 0 4 This is the beta 2 revision of the tasks 1 ILASM pulled the owner attribute added keyfile for giving binaries a strong name MDS hash of the checksum CSC added win32res noConfig utf8output fullpaths CSC 151 7 1 9 7 1 Task CSC 8 0 2 Version 0 3 The changes here reflect Beta 1 of the dotnet SDK and experience of use in more complex projects This build does not work with the older SDK primarily because the automatic reference feature references libraries only found in the new SDK version External changes Recursive inclusion of cs and il files Documentation enhanced includes examples and details of all parameters The csc task automatically includes the common dotnet assemblies so there is no need to remembe
208. ound file if the build failed three times if the fun property is set to true If the target is a dependency of an initialization target that other targets depend on the fun done property prevents the target from being executed more than once lt target name fun if fun unless fun done gt lt sound gt lt success source intranet sounds success gt lt fail source intranet sounds failure gt lt sound gt lt property name fun done value true gt lt target gt 252 Ant User Manual 7 30 3 Examples randomly selects a sound file to play when the build succeeds or fails 253 7 31 Starteam 7 31 Starteam 7 31 1 Description Checks out files from a StarTeam project The includes and excludes attributes function differently from other tasks in Ant Multiple patters must be seperated by spaces not commas See the examples for more information This program makes use of functions from the StarTeam API As a result this task is only available to licensed users of StarTeam You must have starteam sdk jar in your classpath to run this task For more information about the StarTeam API and how to license it see the http www star base com web site 7 31 2 Parameters Description The name of the StarTeam server The port number of the StarTeam server The name of the StarTeam project The name of the view in the StarTeam project The username of the account used to lo
209. ources directory together into a file called app jar in the dist 1ib directory Files with the name Test class are excluded If there are files such as build classes mypackage MyClass class and S src resources mypackage image gif they will appear in the same directory in the JAR and thus be considered in the same package by Java 82 Ant User Manual 6 29 Java 6 29 Java 6 29 1 Description Executes a Java class within the running Ant VM or forks another VM if specified Be careful that the executed class doesn t call System exit because it will terminate the VM and thus Ant In case this happens it s highly suggested that you set the fork attribute so that System exit stops the other VM and not the one that is currently running Ant 6 29 2 Parameters Description Required the Java class to execute Either jar or classname the location of the jar file to execute must have a Main Class entry in the Either jar or manifest Fork must be set to true if this option is selected classname the arguments for the class that is executed deprecated use nested lt arg gt elements instead the classpath to use the classpath to use given as reference p 15 to a PATH defined elsewhere if enabled triggers the class execution in another VM disabled by default the command used to invoke the Java Virtual Machine default is java The command is resolved by java lang Runtime ex
210. output to be in utf 8 format true or false default warnLevel level of warning currently between 1 and 4 with 4 being the strictest 1 mong win32Icon filename of icon to include res myicon ico win32res Example lt csc optimize true debug false filename of a win32 resource RES file to include This is not a NET resource but it what windows is used to docFile documentation xml1 warnLevel 4 unsafe false targetType exe incremental false definitions RE LEASE excludes src unicode_class cs mainClass MainApp outputFile NetApp exe gt 7 1 10 Task ilasm res myapp res Task to assemble net Intermediate Language files The task will only work on windows until other plat forms support csc exe or an equivalent ilasm exe must be on the execute path too All parameters are optional lt il gt should suffice to produce a debug build of all il files The option set is roughly compatible with the CSharp class even though the command line options are only vaguely equiv alent The low level commands take things like OUT file csc wants out file verbose is used some places quiet here in ildasm etc It would be nice if someone made all the command line tools consis tent and not as brittle as the java cmdline tools 154 Ant User Manual 7 1 10 Task ilasm The task is a directory based task so
211. ow 4 1 1 Projects A project has three attributes Description the name of the project the default target to use when no target is supplied the base directory from which all path calculations are done This attribute might be overridden by setting the basedir property beforehand When this is done it must be omitted in the project tag If neither the attribute nor the property have been set the parent directory of the buildfile will be used Optionally a description for the project can be provided as a top level lt description gt element see the description p 21 type Each project defines one or more targets A target is a set of tasks you want to be executed When starting Ant you can select which target s you want to have executed When no target is given the project s default is used 4 1 2 Targets A target can depend on other targets You might have a target for compiling for example and a target for creating a distributable You can only build a distributable when you have compiled first so the distribute target depends on the compile target Ant resolves these dependencies It should be noted however that Ant s depends attribute only specifies the order in which targets should be executed it does not affect whether the target that specifies the dependency s gets executed if the dependent target s did not need to run Ant tries to execute the targets in the depends attribute
212. patterns The exclude or excludesfile attribute is used to specify the files you want to have excluded This is also done with patterns And finally with the default excludes attribute you can specify whether you want to use default exclusions or not See the section on directory based tasks p 17 on how the inclusion exclusion of files works and how to write patterns This task forms an implicit p 25 and supports all attributes of lt fileset gt dir becomes basedir as well as the nested lt include gt lt exclude gt and lt patternset gt elements You can also use nested file sets for more flexibility and specify multiple ones to merge together different trees of files into one JAR The extended fileset attributes from the zip task are also available in the jar task See the Zip p 146 task for more details and examples If the manifest is omitted a simple one will be supplied by Ant You should not include META INF MANIFEST ME in your set of files The update parameter controls what happens if the JAR file already exists When set to yes the JAR file is updated with the files specified When set to no the default the JAR file is overwritten An example use of this is provided in the p 146 The whenempty parameter controls what happens when no files match If create the default the JAR is created anyway with only a manifest If skip the JAR is not created and a warning is issued If fail the JA
213. r to refer to System dll System Web Services etc This feature can be disabled by setting the includeDefaultReferences flag to false References can also be referred to using the ReferenceFiles parameter which is an ant path specifica tion The old references string is still retained An extraoptions attribute enables the build file to include any CSC options which are not explicitly supported in the CSC task Internal changes The Some minor refactoring move common code a method Application of Jedits JavaStyle task resulted in a major reshaping of the codebase and the insertion of a blank line every second line Significant effort was required to revert some but not all changes Removed throws clause from methods which can t throw exceptions test harness has been expanded to include unicode source file the build works but the rest of the system has issues with high unicode package and method names 7 1 8 0 3 Version 0 2 First public edition added to the ant cvs tree Tested on the PDC build of the dotnet SDK only and still immature The command execution code was refactored out into a NetCommand class for re use The Tlasm task was added at this time 7 1 8 0 4 Version 0 1 Initial proof of concept very rudimentary support for CSC only 7 1 9 Task CSC This task compiles CSharp source into executables or modules This task compiles CSharp source into executables or modules Th
214. r a workspace using the PVCS GUI clients If this isn t specified the default workspace for the current user is used On some systems the PVCS executables pcli and get are not found in the PATH In such cases this attribute should be set to the bin directory of the PVCS installation containing the executables mentioned before If this attribute isn t specified the tag expects the executables to be found using the PATH environment variable ignorereturncode If set to true the return value from executing the pvcs commands are ignored updateonly If set to true files are gotten only if newer than existing local files 7 26 3 3 Nested Elements 7 26 3 4 pvcsproject element pvcs supports a nested lt pvcsproject gt element that represents a project within the PVCS repository to extract files from By nesting multiple lt pvcsproject gt elements under the lt pvcs gt task multiple projects can be specified 7 26 3 5 Parameters Attribute Description Required name The name of the pvcs project Yes 245 7 26 3 Pvcs Task 7 26 3 6 Examples The following set up extracts the latest version of the files in the pvcs repository lt Z222 gt lt Get the latest version gt lt l gt lt target name getlatest gt lt pvcs repository mnt pvcs pvcsproject myprj gt lt target gt Now run ant getlatest This will cause the following output to appear getlatest
215. r jj metamatahome c metamata cleanup true gt lt classpath gt lt pathelement location c metamata examples gt lt classpath gt lt mparse gt This invokes Metamata MParse installed in c metamata on one of the grammar file example Java Parser j 3 and cleans up the intermediate Sun JavaCC file 7 22 Native2Ascii 7 22 1 Description Converts files from native encodings to ASCII with escaped Unicode A common usage is to convert source files maintained in a native operating system encoding to ASCII prior to compilation Files in the directory src are converted from a native encoding to ASCII By default all files in the direc tory are converted However conversion may be limited to selected files using includes and excludes attributes For more information on file matching patterns see the section on directory based tasks p 17 If no encoding is specified the default encoding for the JVM is used If ext is specified then output files are renamed to use it as a new extension More sophisticated file name translations can be achieved using a nested lt mapper gt element By default an p 28 will be used If dest and src point to the same directory the ext attribute or a nested lt mapper gt is required This task forms an implicit p 25 and supports all attributes of lt fileset gt dir becomes src as well as nested lt include gt lt exclude gt and lt patternset gt elements 229 7 22 2 Ex
216. r running ant must have access to the commands of PVCS get and pcli and must have access to the repository Note that the way to specify the repository is platform dependent so use property to specify location of repository This version has been tested agains PVCS version 6 5 and 6 6 under Windows and Solaris 7 26 3 Pvcs Task 7 26 3 1 Description The pvcs task is set to point at a PVCS repository and optionally a project within that repository and can from that specification get the latest version of the files contained by the repository 7 26 3 2 Parameters 244 Ant User Manual 7 26 3 Pvcs Task Description The location of the repository see your PVCS manuals The project within the PVCS repository to extract files from is root project and that is default if this attribute isn t specified Only files marked with this label are extracted Only files within this promotion group are extracted Using both the label and the promotiongroup tag will cause the files in the promotion group and with that label to be extracted If set to yes all files that exists and are writable are overwritten Default no causes the files that are writable to be ignored This stops the PVCS command get to stop asking questions By specifying a workspace the files are extracted to that location A PVCS workspace is a name for a location of the workfiles and isn t as such the location itself You define the location fo
217. r string default or default for all datatypes for date and int only Initial value to set for a property if it is not already defined in the property file For type date two additional keywords are allowed now or never For int and date type only If present Values will be parsed and formatted accord ingly 7 25 3 3 Examples The following changes the my properties file Assume my properties look like A comment akey novalue After running the file would now look like Thu Nov 02 23 41 47 EST 2000 akey avalue adate 2000 11 02 23 41 anint 1 formated int 0014 formated date 028 17 34 The slashes conform to the expectations of the Properties class The file will be stored in a manner so that each character is examined and escaped if necessary Note that the original comment is now lost Please keep this in mind when running this task against heavily commented properties files It may be best to have a commented version in the source tree copy it to a deployment area and then run the modifications on the copy Future versions of PropertyFile will hopefully eliminate this shortcoming lt propertyfile file my properties comment My properties gt lt entry key akey value avalue gt lt entry key adate type date value now gt lt entry key anint type int operation gt lt entry key formated int type int default 0013 operation pattern 0000
218. rce called foo properties Note that you can reference a global properties file for all of your Ant builds using the following lt property file user home ant global properties gt since the user home property is defined by the Java virtual machine to be your home directory This technique is more appropriate for Unix than Windows since the notion of a home directory doesn t exist on Windows On the JVM that I tested the home directory on Windows is C Different JVM imple mentations may use other values for the home directory on Windows lt property environment env gt lt echo message Number of Processors S env NUMBER_OF_PROCESSORS gt lt echo message ANT_HOME is set to env ANT_HOME gt reads the system environment variables and stores them in properties prefixed with env Note that this only works on select operating systems Two of the values are shown being echoed 109 6 39 Record 6 39 Record 6 39 1 Description A recorder is a listener to the current build process that records the output to a file Several recorders can exist at the same time Each recorder is associated with a file The filename is used as a unique identifier for the recorders The first call to the recorder task with an unused filename will create a recorder using the parameters provided and add it to the listeners of the build All subsequent calls to the recorder task using this filename w
219. rce directory copy all files into a single directory specified by the todir attribute default is false Note that you can achieve the same effect by using afflatten mapper p 29 includeEmptyDirs Copy empty directories included with the nested FileSet s Defaults to yes 6 34 3 Parameters specified as nested elements 6 34 3 1 mapper You can define file name transformations by using a nested mapper p 28 element The default mapper used by lt copy gt is the identity p 28 99 6 34 4 Examples 6 34 4 Examples Move a single file rename a file lt move file file orig tofile file moved gt Move a single file to a directory lt move file file orig todir dir to move to gt Move a directory to a new directory lt move todir new dir to move to gt lt fileset dir src dir gt lt move gt Move a set of files to a new directory lt move todir some new dir gt lt fileset dir my src dir gt lt include name jar gt lt exclude name ant jar gt lt fileset gt lt move gt Append bak to the names of all files in a directory lt move todir my src dir gt lt fileset dir my src dir gt lt exclude name bak gt lt fileset gt lt mapper type glob from to bak gt lt move gt 100 Ant User Manual 6 35 Parallel 6 35 Parallel 6 35 1 Description Parallel is a container task it can contain other Ant tasks
220. rd include or exclude patterns and don t care about missing files Use a FileList when you want to consider the non existence of a file as if it were out of date If there are any non existing files in any source or target FileList all target files will be removed DependSet is useful to capture dependencies that are not or cannot be determined algorithmically For example the lt style gt task only compares the source XML file and XSLT stylesheet against the target file to determined whether to restyle the source Using dependset you can extend this dependency checking to include a DTD or XSD file as well as other stylesheets imported by the main stylesheet 6 16 2 Parameters none 6 16 3 Parameters Specified as Nested Elements 6 16 3 1 srcfileset The nested srcfileset element specifies a p 25 All files included in this fileset will be compared against all files included in all of the targetfileset filesets and targetfilelist filelists Multiple srcfileset filesets may be specified 6 16 3 2 srcfilelist The nested srcfilelist element specifies a p 24 All files included in this filelist will be compared against all files included in all of the targetfileset filesets and targetfilelist filelists Multiple srcfilelist filelists may be specified 6 16 3 3 targetfileset The nested target fileset element specifies a p 25 All files included in this fileset will be compared against all files included in all of the srcfileset
221. rics for each Java package It allows to automatically measure the quality of a design in terms of its extensibility reusability and maintainability to effectively manage and control package dependencies Source file directories are defined by nested lt sourcespath gt see nested elements p 202 Optionally you can also set the outputfile name where the output is stored By default the task writes its report to the standard output The task requires at least the JDepend 1 2 version Note whereas the JDepend tool can be customized to exclude some packages the current jdepend And Task does not have parameters to allow these exclusions Read JDepend specific documentation for that purpose 7 12 2 Parameters Description Required The output file name If not set the output is printed on the standard output No Run the tests in a separate VM No default is ofi i haltonerror Stop the build process if an error occurs during the jdepend analysis No default is off timeout Cancel the operation if it doesn t finish in the given time measured in No milliseconds Ignored if fork is disabled The command used to invoke the Java Virtual Machine default is java The No default command is resolved by java lang Runtime exec Ignored if fork is java disabled The directory to invoke the VM in Ignored if fork is disabled the classpath to use given as reference to a PATH defined elsewher
222. ription comma separated list of patterns of files that must be included All files are included when omitted includesfile the name of a file each line of this file is taken to be an include pattern You can specify more than one include file by using a nested includesfile elements excludes comma separated list of patterns of files that must be excluded no files except default excludes are excluded when omitted excludesfile the name of a file each line of this file is taken to be an exclude pattern You can specify more than one exclude file by using a nested excludesfile elements 5 4 1 Parameters specified as nested elements 5 4 1 1 include and exclude Each such element defines a single pattern for files to include or exclude Description the pattern p 17 to in exclude Only use this pattern if the named property is set Only use this pattern if the named property is not set 5 4 1 2 includesfile and excludesfile If you want to list the files to include or exclude external to your build file you should use the includes file excludesfile attributes or elements Using the attribute you can only specify a single file of each type while the nested elements can be specified more than once the nested elements also support if unless attributes you can use to test the existance of a property Description the name of the file holding the patterns to in exclude Only re
223. ription Required The directory where is intalled JProbe Yes The format of the generated report Must be xml html or text No default to html wow The type of report to be generated Must be executive summary No Default to detailed or verydetailed detailed A numeric value for the threshold for printing methods Must be No default to 100 between 0 and 100 The name of the snapshot file that is the source to the report The name of the generated output file includesource Include text of the source code lines Only applies to format xml No Defaults to and type verydetailed yes 7 15 5 2 1 sourcepath Path to source files can be set via nested sourcepath elements that are PATH like structures p 13 7 15 5 2 2 reference only applies to format xml A reference is a set of classes whose coverage information will be checked against Since Coverage is only able to give you information about loaded classes it will only report classes that were at least used in some points in your tests therefore you will not be able to know what classes are not exercised at all during your tests The reference is an additional feature that will analyze the bytecode of all classes in a given classpath that match some filters and modify the XML report accordingly In short it will remove the classes that do not exists in the reference classpath For example you might have in your report some
224. roperty name zip dir value basedir dist gt lt property name build classes value basedir classes gt lt location of the unzipped Ant source distribution gt lt property name antdistribution dir value u ant 1 3betal gt lt VAJ install dir gt lt property name vaj dir value C IBMVJava2 gt lt path id classpath gt lt pathelement location sre dir gt lt pathelement location vaj dir IDE project_resources IBM IDE Utility class libraries gt lt pathelement location build classes gt lt path gt lt Load Projects into Workspace gt Sine lt target name load description load projects gt lt vajload gt lt project name Ant version 1 3 gt lt project name Apache Oro RegExp version 2 0 1 gt lt vajload gt lt target gt lt Creates the build dirs Kinn Ss lt target name preparedir lt mkdir dir basedir gt lt mkdir dir sre dir gt lt mkdir dir zip dir gt lt mkdir dir build classes gt lt target gt lt target name export depends preparedirs description export projects gt lt mkdir dir srce dir gt lt Export all Ant sources except optional tasks and the Oro sources gt lt vajexport destdir sre dir gt lt include name Ant gt lt exclude name Ant optional gt lt exclude nam Ant org apache tools ant gui gt lt include name
225. rror but not normal failure The user can also specify the nested lt classpath gt element which defines classpath in which the task is executed The user also specifies a subelement per testlet executed which has content that specifies tasklet classname 7 34 3 Examples lt test showSuccess false showBanner false showTrace true forceShowTrace true gt lt classpath refid test classpath gt lt testlet gt org foo MyTestlet lt testlet gt lt testlet gt org foo MyOtherTestlet lt testlet gt lt test gt The above will run the testlets org foo MyTestlet and org foo MyOtherTestlet 259 7 35 wljspc 7 35 wljspc 7 35 0 1 Description Class to precompile JSP s using weblogic s jsp compiler weblogic jspc Tested only on Weblogic 4 5 1 NT4 0 and Solaris 5 7 5 8 7 35 0 2 Parameters Values oot of source tree for JSP ie the document root for your weblogic server root of destination directory what you have set as WorkingDir in the weblogic properties start package name under which your JSP s would be compiled Class path to use when compiling jsp s A classpath should be set which contains the weblogic classes as well as all application classes referenced by the JSP The system classpath is also appended when the jspc is called so you may choose to put everything in the classpath while calling Ant However since presumably the JSP s will reference classes be
226. ry tree To do this must be used as the name of a directory When is used as the name of a directory in the pattern it matches zero or more directories For example test matches all files directories under test suchas test x java or test foo bar xyz html but not xyz xml 5 1 2 Examples There is one shorthand if a pattern ends with or then is appended For example mypack age test is interpreted as if it were mypackage test Example patterns xx CVS Matches all files in CVS directories that can be located anywhere in the directory tree Matches CVS Repository org apache CVS Entries org apache jakarta tools ant CVS Entries But not Cx x Pnt ri PE yE j E t org apache jakarta ralar s rg epacekh SHE bar Enteies SA Matches all files in the org apache jakarta directory tree Matches y y aE part org apache jakarta tools ant docs index html org apache jakarta test xml But not org apache xyz java org apache CVS jakarta partis missing Matches all files in CVS directories that are located anywhere in the directory tree under org apache Matches org apache CVS Entries org apache jakarta tools ant CVS Entries But not org apache CVS foo bar Entries oo bar part does not match x x test Matches all files that have a test element in their path including test as a filename When these patterns are used in inc
227. s V1 0 Initial Release donated to ASF V1 1 fixed cross platform NT Unix bug refactored p4 output handling code refactored exec ing code 240 Ant User Manual 7 25 Ant PropertyFile Task User Manual 7 25 Ant PropertyFile Task User Manual by Thomas Christen chr active ch Jeremy Mawson jem loftinspace com au mailto jem loftinspace com au Version 1 1 2001 01 28 7 25 1 Table of Contents o inraductionlip 241 PropertyFile Task p 241 Entry Task p 241 7 25 2 Introduction Ant provides an optional task for editing property files This is very useful when wanting to make unat tended modifications to configuration files for application servers and applications Currently the task maintains a working property file with the ability to add properties or make changes to existing ones However any comments are lost Work is being done to make this task a bit more human friendly 7 25 3 PropertyFile Task 7 25 3 1 Parameters Description Required Location of the property file to be edited Yes Header for the file itself no 7 25 3 2 Parameters specified as nested elements 7 25 3 2 1 Entry Use nested lt ent ry gt elements to specify actual modifcations to the property file itself 241 7 25 3 PropertyFile Task Description Name of the property name value pair Value to set to add or subtract Regard the value as int date o
228. s Over time we expect further optional tasks to support additional EJB Servers Ant provides a number of optional tasks for developing http java sun com products ejb In general these tasks are specific to the particular vendor s EJB Server At present the tasks support Weblogic http www bea com 4 5 1 and 5 1 EJB servers Over time we expect further optional tasks to support additional EJB Servers 7 7 3 EJB Tasks 168 Ant User Manual 7 7 4 ddcreator Task Application Servers p 186 Borland Application Server 4 5 p 169 Weblogic 4 5 1 lejbc p 170 Weblogic 4 5 1 fiplanet ejbc p 171 iPlanet Application Server 6 0 Nested Elements p 187 Borland Application Server 4 5 lejbjar p 175 jBoss p 178 jBoss p 183 iPlanet Application Server 6 0 weblogic p 179 Weblogic 5 1 amp 6 0 wirun p 172 Weblogic 4 5 1 5 1 amp 6 0 wlstop p 174 Weblogic 4 5 1 5 1 amp 6 0 7 7 4 ddcreator 7 7 4 1 Description ddcreator will compile a set of Weblogic text based deployment descriptors into a serialized EJB deploy ment descriptor The selection of which of the text based descriptors are to be compiled is based on the standard Ant include and exclude selection mechanisms 7 7 4 2 Parameters Description This is the base directory from which descriptors are selected The directory where the serialised deployment descriptors will be written This is
229. s an output dir parameter otherwise it will be generated in the current directory it can be run in Ant as follows lt java classname org apache xalan xslt Process gt lt param value IN gt lt param value metrics xml gt lt param value XSL gt lt param value maudit frames xsl gt lt param value PARAM gt lt param value output dir gt lt param value amp quot S report dir amp quot gt lt java gt 7 20 MimeMail 7 20 1 Description Sends SMTP mail with MIME attachments If no attachments are needed use the built in p 97 task http java sun com products javamail index html and Java Activation Framework http java sun com products javabeans glasgow jaf html are required for this task Multiple files can be attached using p 25 7 20 2 Parameters 226 Ant User Manual 7 20 3 Examples Attribute Description Required message The message body No but only one of of message or message File may be specified If not specified a fileset must be provided messageFile A filename to read and used as the message body messageMimeType MIME type to use for message No defaults to text plain or messageFile when attached tolist Comma separated list of To Yes at least one of tolist cclist or bcclist recipients must be specified cclist Comma separated list of CC recipients beclist Comma separated list
230. s are always passed regardless of the setting of inheritAll This allows you to parameterize your subprojects 6 2 2 Parameters Description the buildfile to use Defaults to build xml the directory to use as a basedir for the new Ant project Defaults to the current directory the target of the new Ant project that should be executed Filename to write the ant output to If t rue pass all properties to the new Ant project Defaults to t rue 6 2 3 Examples lt ant antfile subproject subbuild xml dir subproject target compile gt lt ant dir subproject gt lt ant antfile subproject property_based_subbuild xml gt lt property name paraml value version 1 x gt lt property file config subproject default properties gt lt ant gt lt ant inheritAll false antfile subproject subbuild xml gt lt property name output type value html gt lt ant gt 837 6 3 AntCall 6 3 AntCall 6 3 1 Description Call another target within the same build file optionally specifying some properties param s in this context By default all of the properties of the current project will be available in the new project Alternatively you can set the inheritAll attribute to false and only user properties i e those passed on the command line will be passed to the new project In either case the set of properties passed to the new project will override the propertie
231. s disabled No 7 16 3 Nested Elements junit supports a nested lt classpath gt element that represents a PATH like structure p 13 215 7 16 3 Nested Elements 7 16 3 1 jvmarg If fork is enabled additional parameters may be passed to the new VM via nested lt jvmarg gt attributes for example lt junit fork yes gt lt jvmarg value Djava compiler NONE gt lt junit gt would run the test in a VM without JIT lt jvmarg gt allows all attributes described in p 14 7 16 3 2 sysproperty Use nested lt sysproperty gt elements to specify system properties required by the class These proper ties will be made available to the VM during the execution of the test either ANT s VM or the forked VM The attributes for this element are the same as for environment variables p 69 lt junit fork no gt lt sysproperty key basedir value basedir gt Sane would run the test in ANT s VM and make the basedir property available to the test 7 16 3 3 formatter The results of the tests can be printed in different formats Output will always be sent to a file unless you set the usefile attribute to false the name of the file is determined by the name of the test and can be set by the out file attribute of lt test gt There are three predefined formatters one prints the test results in XML format the other emit plain text The formatter named brief will only print detailed
232. s may also be used Indicates whether or not the Java source files which are generated by ejbc will be saved or automatically deleted If yes the source files will be retained If omitted it defaults to no Indicates whether or not the ejbc utility should log additional debugging state ments to the standard output If yes the additional debugging statements will be generated If omitted it defaults to no May be used to specify the home directory for this iAS installation This is used to find the ejbc utility if it isn t included in the user s system path If spec ified it should refer to the install location iplanet ias6 ias directory If omitted the ejbc utility must be on the user s system path String value appended to the JAR filename when creating each JAR If omitted it defaults to jar 183 7 7 9 ejbjar As noted above the iplanet element supports additional lt classpath gt nested elements 7 7 9 11 Examples This example demonstrates the typical use of the lt iplanet gt nested element It will name each EJB JAR using the basename prepended to each standard EJB descriptor For example if the descriptor named Account ejb jar xml is processed the EJB JAR will be named Account jar lt ejbjar srcdir S build classesdir descriptordir src gt lt iplanet destdir S assemble ejbjar classpath S ias ejbc cpath gt lt include name ejb jar xml gt
233. s that are set in the new project See also the property task p 107 You can also set properties in the new project from the old project by using nested param tags These properties are always passed regardless of the setting of inheritAll This allows you to parameterize your subprojects When a target is invoked by antcall all of its dependent targets will also be called within the context of any new parameters For example if the target doSomethingElse depended on the target init then the antcall of doSomethingElse will call init during the call Of course any properties defined in the antcall task or inherited from the calling target will be fixed and not overridable in the init task or indeed in the doSomethingElse task 6 3 2 Parameters Description The target to execute If true pass all properties to the new Ant project Defaults to true 6 3 3 Parameters specified as nested elements 6 3 3 1 param Specifies the properties to set before running the specified target See p 107 for usage guide lines 6 3 4 Examples lt target name default gt lt antcall target doSomethingElse gt lt param name paraml value value gt lt antcall gt lt target gt lt target name doSomethingElse gt lt echo message param1 S paraml1 gt lt target gt 38 Ant User Manual 6 3 4 Examples Will run the target gt doSomethingElse and echo param1 value
234. s well as the nested lt include gt lt exclude gt and lt patternset gt elements 7 23 2 Parameters Description Whether literals are treated as the java binary type rather than the NetRexx types The classpath to use during compilation Whether comments are passed through to the generated java source Whether error messages come out in compact or verbose format Whether the NetRexx compiler should compile the generated java code Whether or not messages should be displayed on the console Whether variable cross references are generated Whether decimal arithmetic should be used for the NetRexx code defaultexcludes indicates whether default excludes should be used or not yes no Default excludes are used when omitted 231 7 23 2 Parameters the destination directory into which the NetRexx source files should be copied and then compiled Whether diagnostic information about the compile is generated comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted the name of a file Each line of this file is taken to be an exclude pattern Whether variables must be declared explicitly before use Whether the generated java code is formatted nicely or left to match NetRexx line numbers for call stack debugging comma separated list of patterns of files that must be included All files are
235. same as the name of the grammar file less the jj extension For additional information about MParse please consult the online manual available http down load metamata com parse pdf PDF 7 21 3 Parameters Description Required The jj grammar file to process It will only be processed if the grammar Yes is newer than the corresponding java file The home directory containing the Metamata distribution Enable all messages Enables parser debugging Enables scanner debugging Remove the intermediate Sun JavaCC file created during the transforma No Default to tion of the grammar file false Set the maximum memory for the JVM this is a convenient way to set No the mx or Xmx argument 228 Ant User Manual 7 22 Native2Ascii 7 21 4 Nested elements 7 21 4 1 jvmarg Additional parameters may be passed to the VM via nested lt jvmarg gt attributes lt j vmarg gt allows all attributes described in Command line arguments p 14 7 21 4 2 classpath Sets class path also source path unless one explicitly set Overrides METAPATH CLASSPATH environ ment variables The classpath element represents a PATH like structure p 13 7 21 4 3 sourcepath Sets source path Overrides the SOURCEPATH environment variable The sourcepath element repre sents a PATH like structure p 13 7 21 5 Example lt mparse target c metamata examples parseexamples javagrammars singlefile JavaParse
236. same file is selected by more than one fileset it will be included in the tar file twice with the same path Note The patterns in the include and exclude elements are considered to be relative to the corresponding dir attribute as with all other filesets In the example above dist name is not an absolute path but a simple name of a directory so dist name is a valid path relative to dist name 131 6 49 Taskdef 6 49 Taskdef 6 49 1 Description Adds a task definition to the current project such that this new task can be used in the current project Two attributes are needed the name that identifies this task uniquely and the full name of the class including the packages that implements this task You can also define a group of tasks at once using the file or resource attributes These attributes point to files in the format of Java property files Each line defines a single task in the format taskname fully qualified java classname Taskdef should be used to add your own tasks to the system See also Writing your own task p 276 6 49 2 Parameters Description Required the name of the task Yes unless file or resource have been specified the full class name implementing the task Yes unless file or resource have been specified Name of the property file to load taskname classname No pairs from Name of the property resource to load taskname class name pairs from the classpath
237. se if no files match 143 6 58 3 Nested elements 6 58 3 Nested elements 6 58 3 1 lib The nested 1ib element specifies a p 25 All files included in this fileset will end up in the WEB INE 1ib directory of the war file 6 58 3 2 classes The nested classes element specifies a p 25 All files included in this fileset will end up in the WEB INF classes directory of the war file 6 58 3 3 webinf The nested webinf element specifies a p 25 All files included in this fileset will end up in the you will get a warning 6 58 3 4 metainf WEB INF directory of the war file If this fileset includes a file named web xm1 the file is ignored and The nested met ainf element specifies a p 25 All files included in this fileset will end up in the ignored and you will get a warning 6 58 4 Examples Assume the following structure in the project s base directory thirdparty libs jdbcl jar thirdparty libs jdbc2 jar build main com myco myapp Servlet class src metadata myapp xml src html myapp index html src jsp myapp front jsp src graphics images gifs small logo gif src graphics images gifs large logo gif then the war file myapp war created with lt war warfile myapp war webxml src metadata myapp xml gt lt fileset dir src html myapp gt lt fileset dir src jsp myapp gt lt lib dir thirdparty libs gt lt exclude name jdbcl jar gt
238. ser the parser to use default crimson where to find the parser class Optionally can use an embedded classpath element fails on a error if set to true defaults to true log parser warn events 7 36 3 Examples lt xmlvalidate file toto xml gt lt xmlvalidate failonerror no lenient yes warn yes classname org apache xerces parsers SAXParser gt classpath lib xerces jar gt lt fileset dir srce includes style xsl gt lt xmlvalidate gt 262 Ant User Manual 8 IDE Integration 8 IDE Integration 8 1 About Antidote Version 0 1 2001 02 13 Authors Simeon H K Fitch mailto simeon fitch net 8 1 1 Overview Antidote is the http jakarta apache org ant index html subproject for developing a graphical user interface to facilitate the efficient use of Ant In general its purpose is to allow the quick generation modification and use of Ant build files helping the user define a build process and track down build prob lems It is not meant to be an IDE but an enabler for the powerful features available in Ant particularly for novice users or users who want a rapid way of controlling their build process 8 1 2 Status Antidote is still in the early stages of development but does have a set of usable features including Reading Ant build files Selecting targets and executing them Context highlighted build status console Modification of some build
239. served from the VOB time Either currenttime or preservetime can be specified 7 4 4 3 Examples lt ccupdat viewpath c views viewdir graphical false log log log overwrite true currenttime true rename false gt Does a ClearCase update on the directory c views viewdir A graphical dialog will be displayed The output will be logged to og log and it will overwrite any hijacked files The modified time will be set to the current time 161 7 5 Continuus Support 7 5 Continuus Support CCMCHecKip 162 CCMCheckoul ip 1621 e CCMCheckinTasl p 1631 e CCMReconfigure ip 163 o CCMCreateTask ip 1641 These ant tasks are wrappers around Continuus Source Manager They have been tested with version 5 1 on Windows 2000 but should work on other platforms with ccm installed 7 5 1 CCMCheckin 7 5 1 1 Description Task to checkin a file 7 5 1 2 Parameters Attribute Values Required Path to the file that the command will operate on Specify a comment Default is Checkin plus the date Specify the task number used to check in the file may use default path to the ccm executable file required if it is not on the PATH 7 5 1 3 Examples lt cemcheckin file c wa com foo MyFile java comment mycomment gt Checks in the file c wa com foo MyFile java Comment attribute mycomment is added as a task comment The task used is the one set as the default
240. sing the Java source To learn more about how this information is obtained from the class files please refer to the Java Virtual Machine Specification http java sun com docs books vmspec Since a class dependencies only change when the class itself changes the depend task is able to cache dependency information Only those class files which have changed will have their dependency informa tion re analysed Note that if you change a class dependencies by changing the source it will be recom piled anyway You can examine the dependency files created to understand the dependencies of your classes Please do not rely however on the format of the information as it may change in a later release Once depend discovers all of the class dependencies it inverts this relation to determine for each class which other classes are dependent upon it This affects list is used to discover which classes are invali dated by the out of date class The class files of the invalidated classes are removed triggering the compi lation of the affected classes The depend task supports an attribute closure which controls whether depend will only consider direct class class relationships or whether it will also consider transitive indirect relationships For example say there are three classes A which depends on B which in turn depend on C Now say that class C is out of date Without closure only class B would be removed by depend With closure
241. single argument and cause most calls to fail Note2 If you are using Ant on Windows and a new DOS Window pops up for every command which is executed this may be a problem of the JDK you are using This problem may occur with all JDK s lt 1 2 69 6 21 Fail 6 21 Fail 6 21 1 Description Exits the current build just throwing a BuildException optionally printing additional information The message of the Exception can be set via the message attribute or character data nested into the element 6 21 2 Parameters message A message giving further information on why the build exited 6 21 3 Examples lt fail gt will exit the current build with no further information given BUILD FAILED build xml 4 No message lt fail message Something wrong here gt will exit the current build and print something like the following to wherever your output goes BUILD FAILED build xml 4 Something wrong here lt fail gt Something wrong here lt fail gt will give the same result as above 70 Ant User Manual 6 22 Filter 6 22 Filter 6 22 1 Description Sets a token filter for this project or read multiple token filter from an input file and sets these as filters Token filters are used by all tasks that perform file copying operations through the Project commodity methods Note 1 the token string must not contain the separators chars Note 2 Either token and value attributes must be provided
242. sk has been written using JProbe Suite Server Side 3 0 It is highly recommended to read the JProbe documentation to understand the values of the command line arguments described below This document is less complete than the manual it only gives the basic infor mation and is not intended as a replacement to the manual 7 15 2 Tasks p 208 Measure coverage of Java code JPCovMerge p 212 Merge different snapshots into one JPCovReport p 212 Create a report from a snapshot 7 15 3 JPCoverage Perform code covering functions by comparing source code line execution to the program s source code as a whole 7 15 3 1 Parameters 208 Ant User Manual Description 7 15 3 JPCoverage Required The directory where is intalled JProbe Yes Indicates which virtual machine to run Must be one of jdk117 jdk118 or java2 If java2 is specified the user is also required to specify a path via javahome otherwise it will check if the current executing VM is 1 2 and use its java home property to determine its location in the registry for the default 1 2 x Java 2 VM No default to embedded VM if 1 2 For Java 2 only specifies the path of the jdk1 2 x virtual machine to be used This is only valid when specifying the vm java2 No use only for java2 Similar to javahome except this is the path to the java executable No use only for java2 Run an applet The default is false unless the fi
243. sspath gt lt pathelement path descriptorbuild classpath gt lt classpath gt lt weblogic gt lt include name ejb jar xml gt lt exclude name weblogic ejb jar xml gt 181 7 7 9 ejbjar lt dtd publicId Sun Microsystems Inc DTD Enterprise JavaBeans 1 1 EN location weblogic home classes weblogic ejb deployment xml ejb jar dtd gt lt dtd publicId BEA Systems Inc DTD WebLogic 5 1 0 EJB EN location weblogic home classes weblogic ejb deployment xml weblogic ejb jar dtd gt lt ejbijar gt This example shows ejbjar being used to generate a single deployment jar using a Weblogic EJB container This example does not require the deployment descriptors to use the naming standard This will create only one ejb jar file gt TheEJBJar jar lt ejbjar srcdir build classes descriptordir descriptor dir basejarname TheEJBJar gt lt weblogic destdir deploymentjars dir classpath descriptorbuild classpath gt lt include name ejb jar xml gt lt exclude name weblogic xml gt lt ejbjar gt This example shows ejbjar being used to generate deployment jars for a TOPLink enabled entity bean using a Weblogic EJB container This example does not require the deployment descriptors to use the naming standard This will create only one TOPLink enabled ejb jar file Address jar lt ejbjar srcdir build dir destdir S solant ejb dir
244. st and changes the modification time to Jun 28 2000 2 02 pm 14 02 for those used to 24 hour times lt touch datetime 09 10 1974 4 30 pm gt lt fileset dir srce_dir gt lt touch gt changes the modification time to Oct 09 1974 4 30 pm of all files and directories found in src_dir 133 6 51 Tstamp 6 51 Tstamp 6 51 1 Description Sets the DSTAMP TSTAMP and TODAY properties in the current project The DSTAMP property is in the format yyyymmdd TSTAMP is in the format hhmm and TODAY is in the format month day year These properties can be used in the build file for instance to create time stamped filenames or used to replace placeholder tags inside documents to indicate for example the release date The best place for this task is probably in an initialization target 6 51 2 Parameters Attribute Description Required No parameters 6 51 3 Nested Elements The Tstamp task supports a lt format gt nested element that allows a property to be set to the current date and time in a given format The date time patterns are as defined in the Java SimpleDateFormat http java sun com products jdk 1 2 docs api java text SimpleDateFormat html class The format element also allows offsets to be applied to the time to generate different time values Description The property to receive the date time string in the given pattern The date time pattern to be used The values are as defined by the Jav
245. st begin with create followed by the element name An add method must be a public void method that takes a single argument of an Object type with a no argument constructor The name of the add method must begin with add followed by the element name Writea public void execute method with no arguments that throws a BuildException This method implements the task itself 9 1 1 The Life cycle of a Task 1 The task gets instantiated using a no argument constructor at parser time This means even tasks that are never executed get instantiated The task gets references to its project and location inside the buildfile via its inherited project and location variables If the user specified an id attribute to this task the project registers a reference to this newly created task at parser time The task gets a reference to the target it belongs to via its inherited target variable init is called at parser time All child elements of the XML element corresponding to this task are created via this task s crea teXXX methods or instantiated and added to this task via its addXXX methods at parser time All attributes of this task get set via their corresponding set XXX methods at runtime The content character data sections inside the XML element corresponding to this task is added to the 276 Ant User Manual 9 1 2 Example task via its addText method at runtime 9 All attributes of all c
246. sted Elements 7 17 3 1 fileset junitreport collects individual xml files generated by the JUnit task using the nested lt FileSet gt p 25 element 7 17 3 2 report Generate a browsable report based on the document created by the merge 7 17 4 Parameters 220 Ant User Manual Description 7 17 5 Example of report Required The format of the generated report Must be noframes or frames No default to frames The directory where the stylesheets are defined They must be conforming to the following conventions noframes format the stylesheet must be named junit noframes xsl frames format the stylesheet must be named junit frames xsl No Default to embedded stylesheets The directory where the files resulting from the transformation should be written to 7 17 5 Example of report lt junitreport todir reports gt lt fileset dir reports gt lt include name TEST xml1 gt lt fileset gt lt report format frames todir report html gt lt junitreport gt No Default to current directory would generate a TESTS TestSuites xml file in the directory reports and generate the default framed report in the directory report html 221 7 18 MMetrics 7 18 MMetrics by Stephane Bailliez sbailliez imediation com 7 18 1 Requirements This task requires Metamata Development environment 2 0 Webgain Quality Analyzer 2 0 An evaluat
247. t The above will generate documentation in build docs starting from the book src xdocs book xml and using the skin located in directory src skins myskin 256 Ant User Manual 7 33 Telnet 7 33 Telnet 7 33 1 Description Task to automate a remote telnet session The task uses nested lt read gt to indicate strings to wait for and lt write gt tags to specify text to send If you do specify a userid and password the system will assume a common unix prompt to wait on This behavior can be easily over ridden 7 33 2 Parameters Values the login id to use on the telnet server the login password to use on the telnet server the address of the remote telnet server the port number of the remote telnet server Defaults to port 23 initialCR send a cr after connecting yes Defaults to no set a default timeout to wait for a response Specified in seconds Default is no timeout timeout 7 33 3 Examples A simple example of connecting to a server and running a command This assumes a prompt of ogin for the userid and a prompt of assword for the password lt telnet userid bob password badpass server localhost gt lt read gt home bob lt read gt lt write gt ls lt write gt lt read string home bob gt lt telnet gt This task can be rewritten as lt telnet server localhost gt lt read gt ogin lt read gt lt write gt bob lt write gt lt rea
248. t and includes all the html files in examples zip under docs examples The archive might end up containing the files 148 Ant User Manual 6 59 4 Examples docs user guide html index html docs ChangeLog txt docs examples index html 149 7 Optional Tasks 7 Optional Tasks 7 1 NET classes for Ant 7 1 1 Vision Make ant the definitive build tool for NET projects just as it is becoming for java projects 7 1 2 Detail The emergent policy in big java projects is IDE for code and debug Ant for builds test and deployment While IDEs are great for an individual development task Ant not only rebuilds everything insanely fast it has great support for modern deployment tasks ftp upload EJB servers SQL commands all can be done from a relatively simple XML declaration of what you want done Also in a large project especially open source there is no means of dictating which IDE to use Ant gives IDE independence cross platform portability and ease of extensibility Projects using net should be able to use the same tool This will avoid everyone being dependent on Visual Studio net if they have it supplemented with makefiles and batch files Anyone doing mixed java dotnet development will be particulary grateful as they can have a unified build process If at sometime in the future bits of net do appear on different platforms then ant based build files will migrate once the ant tasks have been migrated and any hard co
249. t contain ant jar and any jars classes needed for your chosen JAXP compliant XML parser When you need JDK functionality such as for the javac p 85 task or the rmic p 116 task then for JDK 1 1 the classes zip file of the JDK must be added to the classpath for JDK 1 2 or JDK 1 3 tools jar must be added The scripts supplied with Ant in the bin directory will add the required JDK classes automatically if the JAVA_HOME environment variable is set When you are executing platform specific applications such as the exec p 68 task or the evs p 57 task the property ant home must be set to the directory containing where you installed Ant Again this is set by the Ant scripts to the value of the ANT_HOME environment variable 2 4 Building Ant To build Ant from source you can either install the Ant source distribution or checkout the jakarta ant module from CVS Once you have installed the source change into the installation directory Set the JAVA_HOME environment variable to the directory where the JDK is installed See Installing Ant p 2 for examples on how to do this for your operating system Make sure you have downloaded any auxiliary jars required to build tasks you are interested in These should either be available on the CLASSPATH or added to the 1ib optional directory See p 5 for a list of jar requirements for various features Note that this will make the auxiliary jars available for the building of
250. t you can nest text inside the element this way 6 31 3 5 header Similar to lt doctitle gt 6 31 3 6 footer Similar to lt doctitle gt 6 31 3 7 bottom Similar to lt doctitle gt 6 31 3 8 link Create link to javadoc output at the given URL This performs the same role as the link and linkoffline attributes You can use either syntax or both at once but with the nested elements you can easily specify multiple occurrences of the arguments 6 31 3 8 1 Parameters Description Required The URL for the external documenta tion you wish to link to True if this link is not available online at the time of generating the documentation The location to the directory contain Only if the ing the package list file for the exter offline nal documentation attribute is true 94 Ant User Manual 6 31 3 Parameters specified as nested elements 6 31 3 9 group Separates packages on the overview page into whatever groups you specify one group per table This performs the same role as the group attribute You can use either syntax or both at once but with the nested elements you can easily specify multiple occurrences of the arguments 6 31 3 9 1 Parameters Description Required Title of the group Yes unless nested lt title gt given List of packages to include in that Yes unless nested group Multiple packages are sepa lt package gt s rated with given The title may b
251. tRexxC 7 23 NetRexxC 7 23 1 Description Compiles a NetRexx http www 2 hursley ibm com netrexx source tree within the running Ant VM The source and destination directory will be recursively scanned for NetRexx source files to compile Only NetRexx files that have no corresponding class file or where the class file is older than the java file will be compiled Files in the source tree are copied to the destination directory allowing support files to be located properly in the classpath The source files are copied because the NetRexx compiler cannot produce class files in a specific directory via parameters The directory structure of the source tree should follow the package hierarchy It is possible to refine the set of files that are being compiled copied This can be done with the includes includesfile excludes excludesfile and defaultexcludes attributes With the includes or includesfile attribute you specify the files you want to have included by using patterns The exclude or excludesfile attribute is used to specify the files you want to have excluded This is also done with patterns And finally with the defaultexcludes attribute you can specify whether you want to use default exclusions or not See the section on directory based tasks p 17 on how the inclusion exclusion of files works and how to write patterns This task forms an implicit p 25 and supports all attributes of lt fileset gt dir becomes srcdir a
252. tar gt tars all files in the htdocs manual directory into a file called manual tar in the dist direc tory then applies the gzip task to compress it lt tar tarfile S dist manual tar basedir htdocs manual excludes mydocs todo html gt tars all files in the htdocs manual directory into a file called manual tar in the dist direc tory Files in the directory mydocs or files with the name todo html are excluded 130 Ant User Manual 6 48 4 Examples lt tar longfile gnu tarfile dist base S dist name srce tar gt lt tarfileset dir dist name mode 755 username ant group ant gt lt include name dist name bootstrap sh gt lt include name dist name build sh gt lt tarfileset gt lt tarfileset dir S dis lt include name S dis lt exclude name S dis lt exclude name S dis lt tarfileset gt lt tar gt ct ct name username ant group ant gt name gt name bootstrap sh gt name build sh gt CE Ge igh oct This example shows building a tar which uses the GNU extensions for long paths and where some files need to be marked as executable mode 755 and the rest are use the default mode read write by owner The first fileset selects just the executable files The second fileset must exclude the executable files and include all others Note The tar task does not ensure that a file is only selected by one fileset If the
253. tasks that support this feature or at the same level as target i e as children of project PatternSets can be specified as nested lt patternset gt elements In addition FileSet holds an implicit PatternSet and supports the nested lt include gt lt includesfile gt lt exclude gt and lt excludes file gt elements of PatternSet directly as well as PatternSet s attributes Attribute Description dir the root of the directory tree of this FileSet defaultexcludes indicates whether default excludes should be used or not yes no default excludes are used when omitted includes comma separated list of patterns of files that must be included all files are included when omitted includesfile the name of a file each line of this file is taken to be an include pattern excludes comma separated list of patterns of files that must be excluded no files except default excludes are excluded when omitted excludesfile the name of a file each line of this file is taken to be an exclude pattern 5 6 0 1 Examples lt fileset dir S server src gt lt patternset id non test sources gt lt include name java gt lt exclude name Test gt lt patternset gt lt fileset gt Groups all files in directory server src that are Java source files and don t have the text Test in their name lt fileset dir S client src gt lt patternset refid no
254. terns of files that must be included All files are included when omitted includesfile the name of a file Each line of this file is taken to be an include pattern excludes comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted excludesfile the name of a file Each line of this file is taken to be an exclude pattern defaultexcludes indicates whether default excludes should be used or not yes no Default excludes are used when omitted 113 6 41 3 Examples 6 41 3 Examples lt replace file src index html token value wombat gt replaces occurrences of the string with the string wombat in the file src index html 6 41 4 Parameters specified as nested elements This task forms an implicit p 25 and supports all attributes of lt fileset gt as well as the nested lt include gt lt exclude gt and lt patternset gt elements If either the text you want to replace or the replacement text cross line boundaries you can use nested elements to specify them 6 41 5 Examples lt replace dir src value wombat gt lt include name html gt lt replacetoken gt lt CDATA multi line token gt lt replacetoken gt lt replace gt replaces occurrences of the string multi line Wwtoken with the string wombat in all HTML files in the directory src Where w is the platform spec
255. th gt 24 30 4 1 9 Command line Arguments This builds a path that holds the value of classpath followed by all jar files in the 1ib directory followed by the classes directory If you want to use the same path like structure for several tasks you can define them with a lt path gt element at the same level as targets and reference them via their id attribute see References p 15 for an example A path like structure can include a reference to another path like structure via nested lt path gt elements lt path id base path gt lt pathelement path classpath gt lt fileset dir lib gt lt include name jar gt lt fileset gt lt pathelement location classes gt lt path gt lt path id tests path gt lt path refid base path gt lt pathelement location testclasses gt lt path gt The shortcuts previously mentioned for lt classpath gt are also valid for lt path gt For example lt path id base path gt lt pathelement path classpath gt lt path gt can be written as lt path id base path path classpath gt 4 1 9 Command line Arguments Several tasks take arguments that will be passed to another process on the command line To make it easier to specify arguments that contain space characters nested arg elements can be used Description Required a single command line argument can contain space characters a space delimited list of command line
256. th gt as well that is a path p 13 like structure 6 47 3 2 param Param is used to pass a parameter to the XSL stylesheet 6 47 3 3 Parameters Description Name of the XSL parameter XSL expression to be placed into the param To pass a text value into the style sheet it needs to be escaped using single quotes 6 47 4 Examples lt style basedir doc destdir build doc extension html style style apache xsl gt 6 47 4 1 Using XSL parameters lt style basedir doc destdir build doc extension html style style apache xsl gt lt param name date expression 07 01 2000 gt lt style gt This will replace an xsl param definition lt xsl param name date gt lt xsl param gt with the text value 07 01 2000 128 Ant User Manual 6 48 Tar 6 48 Tar 6 48 1 Description Creates a tar archive The basedir attribute is the reference directory from where to tar This task is a directory based task p 17 and as such forms an implicit Fileset p 25 This defines which files relative to the basedir will be included in the archive The tar task supports all the attributes of Fileset to refine the set of files to be included in the implicit fileset In addition to the implicit fileset the tar task supports nested filesets These filesets are extended to allow control over the access mode username and groupname to be applied to the tar entries This is useful for
257. th the latest development join the http jakarta apache org site mail html Archives of both lists can be found at http archive covalent net Many thanks to Covalent Technologies A searchable archive can be found at http marc theaimsgroup com If you know of any additional archive sites please report them to the lists 280
258. the classpath to use to run the underlying weblogic ddcreator tool This must include the weblogic ejb utils DDCreator class 7 7 4 3 Examples lt ddcreator descriptors dd dir dest S gen classes classpath descriptorbuild classpath gt lt include name txt gt lt ddcreator gt 169 7 7 5 ejbc 7 7 5 ejbc 7 7 5 1 Description The ejbc task will run Weblogic s ejbc tool This tool will take a serialised deployment descriptor examine the various EJB interfaces and bean classes and then generate the required support classes neces sary to deploy the bean in a Weblogic EJB container This will include the RMI stubs and skeletons as well as the classes which implement the bean s home and remote interfaces The ant task which runs this tool is able to compile several beans in a single operation The beans to be compiled are selected by including their serialised deployment descriptors The standard ant include and exclude constructs can be used to select the deployment descriptors to be included Each descriptor is examined to determine whether the generated classes are out of date and need to be regenerated The deployment descriptor is de serialized to discover the home remote and implementation classes The corresponding source files are determined and checked to see their modification times These times and the modification time of the serialised descriptor itself are compared with the modification time o
259. the java files See Notes at the end Yes unless nested lt src gt elements are present location to store the class files comma separated list of patterns of files that must be included all files are included when omitted the name of a file that contains include patterns comma separated list of patterns of files that must be excluded no files except default excludes are excluded when omitted the name of a file that contains exclude patterns indicates whether default excludes should be used yes no default excludes are used when omitted the classpath to use location of bootstrap class files the classpath to use given as afreference p 15 toa PATH defined elsewhere location of bootstrap class files given as afreference p 15 to a PATH defined elsewhere location of installed extensions encoding of source files gcj doesn t support this option yet indicates whether nowarn switch should be passed to the compiler defaults to of f indicates whether source should be compiled with debug information defaults to off indicates whether source should be compiled with optimiza tion defaults to of f indicates whether source should be compiled with depreca tion information defaults to of f generate class files for specific VM version e g 1 1 or 1 2 asks the compiler for verbose output 86 Ant User Manua
260. ticular layout of a WAR file The same thing can be accomplished by using the prefix and fullpath attributes of zipfilesets in a Zip or Jar task The extended zipfileset element from the zip task with attributes prefix fullpath and src is available in the War task 6 58 2 Parameters Description the war file to create The deployment descriptor to use WEB INF web xml the directory from which to jar the files Not only store data but also compress them defaults to true The character encoding to use for filenames inside the archive Defaults to UTFS8 It is not recommended to change this value as the created archive will most likely be unreadable for Java otherwise Store only file entries defaults to false comma separated list of patterns of files that must be included All files are included when omitted includesfile the name of a file Each line of this file is taken to be an include pattern excludes comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted excludesfile the name of a file Each line of this file is taken to be an exclude pattern defaultexcludes indicates whether default excludes should be used or not yes no Default excludes are used when omitted the manifest file to use indicates whether to update or overwrite the destination file if it already exists Behavior to u
261. tml Online discussions about Antidote occur on the jakarta ant mailing list http jakarta apache org site mail html The application infrastructure is fairly complete but there are almost unlimited opportunities for feature contributions Aspiring contributors new to the Jakarta Project should carefully read the following for details on the contribution process Get Involved http jakarta apache org site getinvolved html Project Guidelines http jakarta apache org site guidelines html Source Repositories how to contribute patches http jakarta apache org site source html 264 Ant User Manual 8 2 AntRunner For JBuilder unbundled 8 2 AntRunner For JBuilder unbundled Sec http www dieter bogdoll de java AntRunner 8 3 AntWork Plugin for the Jext Java Text Editor by e Klaus Hartlage KHartlage t online de Version Revision 1 1 Date 2001 03 05 13 07 15 You can download the plugin at ftp jext sourceforge j ins AntWork zip 8 3 1 Installation instructions from the Readme txt You have to enable the Jext Console to see the Ant output menu Edit gt Options General Panel because the Ant messages are redirected to the Jext console You can configure the Ant call in the Jext menu Edit gt Options Plugin Options Antwork Plugin Panel here you can set the ant home directory and the path to your build file You can start AntWork in the menu Plugins gt Ant gt
262. to be executed based on the OS it is executing on 2 Installing Ant 2 Installing Ant 2 1 Getting Ant 2 1 1 Binary Edition The latest stable version of Ant can be downloaded from jakarta apache org builds ant release v1 4 bin If you like living on the edge you can download the latest version from http jakarta apache org builds ant nightly 2 1 2 Source Edition If you prefer the source edition you can download the source for the latest Ant release from http jakarta apache org builds ant release v1 4 src Again if you prefer the edge you can access the code as it is being developed via CVS The Jakarta website has details on http jakarta apache org site cvsindex html Please checkout the jakarta ant module See the section Building Ant p 4 on how to build Ant from the source code You can also access the Ant CVS repositor http cvs apache org viewcvs jakarta ant on line 2 2 System Requirements To build and use Ant you must have a JAXP compliant XML parser installed and available on your class path The binary distribution of Ant includes the latest version of the http xml apache org crimson index html XML parser Please see for more information about JAXP If you wish to use a different JAXP compliant parser you should remove jaxp jar and crimson jar from Ant s lib directory You can then either put the jars from your preferred parser into Ant s 1ib directory or put the jars on the system cl
263. to use when looking up classname or resource 6 49 3 Parameters specified as nested elements 6 49 3 1 classpath Taskdef s classpath attribute is a PATH like structure p 13 and can also be set via a nested classpath element 6 49 4 Examples lt taskdef name myjavadoc classname com mydomain JavadocTask gt makes a task called my javadoc available to Ant The class com mydomain JavadocTask imple ments the task 132 Ant User Manual 6 50 Touch 6 50 Touch 6 50 1 Description Changes the modification time of a file and possibly creates it at the same time In addition to working with a single file this Task can also work alFileset p 25 which also includes directories For JDK 1 1 only the creation of new files with a modification time of now works all other cases will emit a warning 6 50 2 Parameters Description Required the name of the file unless a nested fileset element has been specified specifies the new modification time of the file in milliseconds since midnight Jan 1 1970 specifies the new modification time of the file in the format MM DD YY YY HH MM AM_or_PM If both millis and datetime are omitted the current time is assumed 6 50 3 Examples lt touch file myfile gt creates my file if it doesn t exist and changes the modification time to the current time lt touch file myfile datetime 06 28 2000 2 02 pm gt creates myfile if it doesn t exi
264. tory gt lt mkdir dir dist lib gt lt Put everything in build into the MyProject DSTAMP jar file gt lt jar jarfile dist lib MyProject DSTAMP jar basedir build gt lt target gt lt target name clean gt lt Delete the build and dist directory trees gt lt delete dir S build gt lt delete dir dist gt lt target gt lt project gt 4 1 7 Token Filters A project can have a set of tokens that might be automatically expanded if found when a file is copied when the filtering copy behavior is selected in the tasks that support this These might be set in the build file by the p 71 12 Ant User Manual 4 1 8 Path like Structures Since this can potentially be a very harmful behavior the tokens in the files must be of the form token where token is the token name that is set in the filter task This token syntax matches the syntax of other build systems that perform such filtering and remains sufficiently orthogonal to most programming and scripting languages as well as with documentation systems Note If a token with the format token is found in a file but no filter is associated with that token no changes take place therefore no escaping method is available but as long as you choose appropriate names for your tokens this should not cause problems Warning If you copy binary files with filtering turned on you can corrupt the files This feature shou
265. ue comment Some comment text gt Does a ClearCase checkout on the file c views viewdir afile It is checked out as reserved on branch called abranch All warning messages are suppressed A Some comment text is added to ClearCase as a comment 7 4 3 CCUnCheckout 7 4 3 1 Description Task to perform a UnCheckout command to ClearCase 7 4 3 2 Parameters Values Path to the ClearCase view file or directory that the command will operate on Specifies whether to keep a copy of the file with a keep extension or not 160 Ant User Manual 7 4 4 CCUpdate 7 4 3 3 Examples lt ccuncheckout viewpath c views viewdir afile keepcopy true gt Does a ClearCase uncheckout on the file c views viewdir afile A copy of the file called c views viewdir afile keep is kept 7 4 4 CCUpdate 7 4 4 1 Description Task to perform an Update command to ClearCase 7 4 4 2 Parameters Attribute Values viewpath Path to the ClearCase view file or directory that the command will operate on Displays a graphical dialog during the update Specifies a log file for ClearCase to write to Specifies whether to overwrite hijacked files or not Specifies that hijacked files should be renamed with a keep extension Specifies that modification time should be written as the current time Either currenttime or preservetime can be specified Specifies that modification time should pre
266. uential gt lt sleep seconds 30 gt lt 7 UNA ee nae lt wlstop gt lt sequential gt lt parallel gt This example represents a typical pattern for testing a server application In one thread the server is started the wlrun task The other thread consists of a three tasks which are performed in sequence The sleep task is used to give the server time to come up Another task which is capable of validating that the server is available could be used in place of the sleep task The test harness is then run Once the tests are complete the server is stopped using wlstop in this example allowing both threads to complete The parallel task will also complete at this time and the build will then continue 101 6 35 2 Examples lt parallel gt lt javac gt lt compiler servlet cod gt lt wijspc ou precompile JSPs gt lt parallel gt This example shows two independent tasks being run to achieve better resource utilization during the build In this instance some servlets are being compiled in one thead and a set of JSPs is being precom piled in another As noted above you need to be careful that the two tasks are independent both in terms of their dependencies and in terms of their potential interactions in Ant s external environment 102 Ant User Manual 6 36 Patch 6 36 Patch 6 36 1 Description Applies a diff file to originals 6 36 2 Parameters Description Required the file that i
267. uild and includes the contents of build log in the body of the message 97 6 33 Mkdir 6 33 Mkdir 6 33 1 Description Creates a directory Also non existent parent directories are created when necessary 6 33 2 Parameters Attribute Description Required dir the directory to create Yes 6 33 3 Examples lt mkdir dir dist gt creates a directory dist lt mkdir dir dist lib gt creates a directory dist lib 98 Ant User Manual 6 34 Move 6 34 Move 6 34 1 Description Moves a file to a new file or directory or sets of files to a new directory By default the destination file is overwritten if it already exists When overwrite is turned off then files are only moved if the source file is newer than the destination file or when the destination file does not exist p 25 s are used to select sets of files to move to the todir directory 6 34 2 Parameters Description Required the file to move One of file or at least one nested fileset element the file to move to With the file attribute either tofile or todir can be used the directory to move to With a nested fileset only todir is allowed overwrite existing files even if the destination files are No newer default is true indicates whether token filtering should take place No during the move See the filter p 71 task for a descrip tion of how filters work ignore directory structure of sou
268. uild more then one Visual Age project to one jar How to A The VA tasks are able to load and export several Projects all at once You can choose whatever project you like for storing the tool information it doesn t really matter 273 8 5 12 Known Problems Q When I load my build file the list of targets is empty Why A You need to add the optional description parameter to the targets You want to come up in the list Then reload the build file in the ant build tool We chose to display only targets with description to allow the build file developer to distinguish between targets for end users and helper targets Q Is there a sample build file available A Now You can find anexample p 270 in this manual Q Why does it export my entire workspace when I ve already implicitly selected a project when starting the Tool A This selection does not carry into the buildfile you are using Set the Project name at the beginning of the includes parameter Q When I import Ant into my Workspace I get Problems reported Can I ignore them A It depends on the problems reported and what you want to do with Ant Problems you can t ignore Classes from javax xml parser missing install a compatible parser see installation p 271 Classes from com ibm ivj util missing install the Visual Age IDE Utility feature see installation p 271 Q Why is the task name vajload when the class is called VA JLoadProjects A
269. uild sh install lite Unix This will only install the bin and 1ib directories Both the install and install lite targets will overwrite the current Ant version in ANT_HOME 2 5 Library Dependencies The following libraries are needed in your CLASSPATH or in the install directory s 1ib directory if you are using the indicated feature Note that only one of the regexp libraries is needed for use with the mappers You will also need to install the Ant optional jar containing the task definitions to make these tasks available Please refer to the Installing Ant Optional Tasks p 3 section above 2 5 Library Dependencies Jar Name Needed For Available At An XSL transformer like Xalan or XSL P style task xml apache org xalan j index htmljor http www clc marketing com xslp jakarta regexp 1 2 jar regexp type with mappers jakarta apache org regexp regexp type with mappers and the perforce tasks jakarta apache org oro junit tasks www junit org stylebook task CVS repository of test task java apache ore framework antlr task script task oss software ibm com developerworks projects bs netrexx task www2 hursley ibm com netrexx javascript with script task python with script task www jpython org netcomponents jar ftp and telnet tasks www savarese org oro downloads Ant User Manual 3 Running Ant 3 Running Ant
270. urces res source directory default project directory Type of target library means DLL is output exe default library output progress messages on off default Example lt ilasm outputFile app exe verbose on listing on owner secret gt 155 7 2 ANTLR 7 2 ANTLR 7 2 1 Description Invokes the ANTLR http www antlr org Translator generator on a grammar file To use the ANTLR task set the target attribute to the name of the grammar file to process Optionally you can also set the outputdirectory to write the generated file to a specific directory Otherwise ANTLR writes the generated files to the directory containing the grammar file This task only invokes ANTLR if the grammar file is newer than the generated files 7 2 2 Parameters Description Required The grammar file to process outputdirectory The directory to write the generated files to If not set the files are No written to the directory containing the grammar file fork Run ANTLR in a separate VM No default is ofi n dir The directory to invoke the VM in ignored if fork is disabled No 7 2 3 Example lt antlr target etc java g outputdirectory build src gt This invokes ANTLR on grammar file etc java g writing the generated files to build src 156 Ant User Manual 7 3 Cab 7 3 Cab 7 3 1 Description The cab task creates Microsoft cab archive files
271. urke for the FAQ additions 275 9 Developing with Ant 9 Developing with Ant 9 1 Writing Your Own Task It is very easy to write your own task 1 2 Create a Java class that extends org apache tools ant Task For each attribute write a setter method The setter method must be a public void method that takes a single argument The name of the method must begin with set followed by the attribute name with the first character of the name in uppercase and the rest in lowercase The type of the attribute can be String any primitive type they are converted for you from their String representation in the buildfile boolean your method will be passed the value true if the value specified in the buildfile is one of true yes or on Class File in which case the value of the attribute is interpreted relative to the project s basedir any other type that has a constructor with a single St ring argument If your task has enumerated attributes you should consider using a subclass of org apache tools ant types EnumeratedAttribute as an argument to your setter method See org apache tools ant taskdefs FixCRLF java for an example If the task should support character data writea public void addText String method For each nested element write a create or add method A create method must be a public method that takes no arguments and returns an Object type The name of the create method mu
272. used when omitted 7 3 3 Examples lt cab cabfile S dist manual cab basedir htdocs manual gt 157 7 3 3 Examples cabs all files in the htdocs manual directory into a file called manual cab in the dist directory lt cab cabfile S dist manual cab basedir htdocs manual excludes mydocs todo html gt cabs all files in the htdocs manual directory into a file called manual cab in the dist directory Files in the directory mydocs or files with the name todo html are excluded lt cab cabfile dist manual cab basedir htdocs manual includes api html excludes todo htm1 verbose yes gt Cab all files in the htdocs manual directory into a file called manual cab in the dist directory Only html files under the directory api are archived and files with the name todo html are excluded Output from the cabarc tool is displayed in the build output 158 Ant User Manual 7 4 ClearCase Support 7 4 ClearCase Support ECChecKialip 159 ECCheckoutlfp 159 CCUnCheckoul ip 160 CCUpaatelip 1611 7 4 1 CCCheckin 7 4 1 1 Description Task to perform a Checkin command to ClearCase 7 4 1 2 Parameters Attribute Values Path to the ClearCase view file or directory that the command will operate on Specify a comment Only one of comment or commentfile may be used Specify a file containing a comment Only one of comment or commentfile may be used
273. utes Description Required specifies one of the built in implementations D Exactly one of both specifies the implementation by class name the classpath to use when looking up classname No the classpath to use given as reference p 15 to a path defined No elsewhere the from attribute for the given implementation Depends on implementa tion the to attribute for the given implementation Depends on implementa tion Note that Ant will not automatically convert or characters in the to and from attributes to the correct directory separator of your current platform If you need to specify this separator use file separa tor instead The classpath can be specified via a nested lt classpath gt as well that is a path p 13 like structure The built in mapper types are 5 11 0 1 identity The target file name is identical to the source file name Both to and from will be ignored Examples lt mapper type identity gt 28 Ant User Manual 5 11 Mapping File Names Source file name Target file name A java A java foo bar B java foo bar B java C properties C properties Classes dir dir2 A properties Classes dir dir2 A properties 5 11 0 2 flatten The target file name is identical to the source file name with all leading directory information stripped off Both to and from will be ignored Examples lt mapper type flatten
274. verything inside the build xml file This option was added in order to make it easier to migrate from regular makefiles where you would use this option of javadoc The packages listed in packagelist are not checked so the task performs even if some packages are missing or broken Use this option if you wish to convert from an existing makefile Once things are running you should then switch to the regular notation DEPRECATION the javadoc2 task simply points to the javadoc task and it s there for back compatibility reasons Since this task will be removed in future versions you are strongly encouraged to use javadoc p 90 instead 6 31 2 Parameters Description Availability Required Specify where to find source files all At least one of the Specify where to find source files by reference all two or nested p 15 to a PATH defined elsewhere lt sourcepath gt Destination directory for output files all Yes unless a doclet has been specified Max amount of memory to allocate to the all No javadoc VM 90 Ant User Manual sourcefiles Comma separated list of source files packagenames Comma separated list of package files with terminating wildcard 6 31 2 Parameters at least one of the two or nested lt source gt or lt package gt The name of a file containing the packages to process Specify where to find user class files Override location of class files loaded
275. w use the platform s default character encoding for filenames this is consistent with the command line ZIP tools but causes problems if you try to open them from within Java and your filenames contain non US ASCII characters Use the encoding attribute and set it to UTF8 to create zip files that can safely be read by Java 6 59 2 Parameters 146 Ant User Manual 6 59 3 Parameters specified as nested elements Description the zip file to create the directory from which to zip the files Not only store data but also compress them defaults to true The character encoding to use for filenames inside the zip file For a list of possible values see http j nat encoding doc html Defaults to the platform s default character encoding Store only file entries defaults to false comma separated list of patterns of files that must be included All files are included when omitted includesfile the name of a file Each line of this file is taken to be an include pattern excludes comma separated list of patterns of files that must be excluded No files except default excludes are excluded when omitted excludesfile the name of a file Each line of this file is taken to be an exclude pattern indicates whether default excludes should be used or not yes no Default excludes are used when omitted indicates whether to update or overwrite the destination file if it already exists
276. write patterns This task forms an implicit FileSet p 25 and supports all attributes of lt fileset gt dir becomes basedir as well as the nested lt include gt lt exclude gt and lt patternset gt elements Or you may place within it nested file sets or references to file sets In this case basedir is optional the implicit file set is only used if basedir is set You may use any mixture of the implicit file set with basedir set and optional attributes like includes and optional subelements like lt include gt explicit nested lt fileset gt elements so long as at least one fileset total is specified The ZIP file will only reflect the relative paths of files within each fileset The Zip task and its derivatives know a special form of a fileset named zipfileset that has additional attributes described below The update parameter controls what happens if the ZIP file already exists When set to yes the ZIP file is updated with the files specified New files are added old files are replaced with the new versions When set to no the default the ZIP file is overwritten The whenempty parameter controls what happens when no files match If skip the default the ZIP is not created and a warning is issued If fail the ZIP is not created and the build is halted with an error If create an empty ZIP file explicitly zero entries is created which should be recognized as such by compliant ZIP manipulation tools This task will no
277. xamples lt junit gt lt test name my test TestCase gt lt junit gt Runs the test defined in my test TestCase in the same VM No output will be generated unless the test fails lt junit printsummary yes fork yes haltonfailure yes gt lt formatter type plain gt lt test name my test TestCase gt lt junit gt Runs the test defined in my test TestCase in a separate VM At the end of the test a single line summary will be printed A detailed report of the test can be found in TEST my test Test Case txt The build process will be stopped if the test fails lt junit printsummary yes haltonfailure yes gt lt classpath gt lt pathelement location build tests gt lt pathelement path java class path gt lt classpath gt lt formatter type plain gt lt test name my test TestCase haltonfailure no outfile result gt lt formatter type xml gt lt test gt lt batchtest fork yes todir reports tests gt 218 Ant User Manual 7 16 4 Examples lt fileset dir src tests gt lt include name Test java gt lt exclude name AllTests java gt lt fileset gt lt batchtest gt lt junit gt Runs my test TestCase in the same VM ignoring the given CLASSPATH only a warning is printed if this test fails In addition to the plain text test results for this test a XML result will be output to result xml For each matchi
278. xamples The following will merge the entries in mergefoo jar and mergebar jar into out jar mac jar and pce jar will be added as single entries to out jar lt jlink compress false outfile out jar gt lt mergefiles gt lt pathelement path build dir mergefoo jar gt lt pathelement path build dir mergebar jar gt lt mergefiles gt lt addfiles gt lt pathelement path build dir mac jar gt lt pathelement path build dir pc zip gt lt addfiles gt lt jlink gt Suppose the file foo jar contains two entries bar class and barnone myClass zip Suppose the path for file foo jar is build tempbuild foo jar The following example will provide the entry tempbuild foo jar in the out jar lt jlink compress false outfile out jar gt lt mergefiles gt lt pathelement path build tempbuild gt lt mergefiles gt lt jlink gt However the next example would result in two top level entries in out jar namely bar class and barnone myClass zip lt jlink compress false outfile out jar gt lt mergefiles gt lt pathelement path build tempbuild foo jar gt lt mergefiles gt lt jlink gt 207 7 15 JProbe 7 15 JProbe by Stephane Bailliez sbailliez imediation com 7 15 1 Introduction This task runs the tools from the JProbe suite For more information visit http www sitraka com An evaluation version is available for download if you already don t own it This ta
279. xecute without any command line arguments Yes the directory where the lt apply gt expects the target files will be placed Yes if you by the command when it is executed specify a nested mapper the directory in which the command should be executed list of Operating Systems on which the command may be executed the file to which the output of the command should be redirected the name of a property in which the output of the command should be stored Stop the command if it doesn t finish within the specified time given in milliseconds Stop the buildprocess if the command exits with a returncode other than 0 Don t run the command if no source files have been found or are newer No default is than their corresponding target files false Run the command only once appending all files as arguments If false No command will be executed once for every file Defaults to false One of file dir or both If set to file only the names of plain files will be No default is sent to the command If set to dir only the names of directories are file considered newenvironment Do not propagate old environment when new environment variables are No default is specified false vmlauncher Run command using the Java VM s execution facilities where available No default is If set to false the underlying OS s shell either directly or through the true antRun scripts will be used
280. y and the full name of the class including the packages that implements this type You can also define a group of data types at once using the file or resource attributes These attributes point to files in the format of Java property files Each line defines a single data type in the format typename fully qualified java classname Typedef should be used to add your own types to the system Data types are things like p 13 or filesets p 25 that can be defined at the project level and referenced via their ID attribute Custom data types usually need custom tasks to put them to good use 6 52 2 Parameters Description Required the name of the data type Yes unless file or resource have been specified the full class name implementing the data type Yes unless file or resource have been specified Name of the property file to load typename classname No pairs from Name of the property resource to load typename class name pairs from the classpath to use when looking up classname 6 52 3 Parameters specified as nested elements 6 52 3 1 classpath Typedef s classpath attribute is a PATH like structure p 13 and can also be set via a nested classpath element 6 52 4 Examples lt typedef name urlset classname com mydomain URLSet gt 136 Ant User Manual 6 52 4 Examples makes a data type called urlset available to Ant The class com mydomain URLSet implements this type 13
281. y using afflatten mapper p 29 includeEmptyDirs Copy empty directories included with the nested FileSet s Defaults to yes 6 9 3 Parameters specified as nested elements 6 9 3 1 fileset p 25 are used to select files to copy To use a fileset the todir attribute must be set 52 Ant User Manual 6 9 4 Examples 6 9 3 2 mapper You can define file name transformations by using a nested mapper p 28 element The default mapper used by lt copy gt is the identity p 28 6 9 3 3 filterset p 26 are used to replace tokens in files that are copied To use a filterset just add the nested filterset elements 6 9 4 Examples Copy a single file lt copy file myfile txt tofile mycopy txt gt Copy a file to a directory lt copy file myfile txt todir some dir tree gt Copy a directory to another directory lt copy todir new dir gt lt fileset dir src_dir gt lt copy gt Copy a set of files to a directory lt copy todir dest dir gt lt fileset dir src_dirquot gt lt exclude name java gt lt fileset gt lt copy gt lt copy todir dest dir gt lt fileset dir src_dirquot excludes java gt lt copy gt Copy a set of files to a directory appending bak to the file name on the fly lt copy todir backup dir gt lt fileset dir src_dirquot gt lt mapper type glob from to bak gt lt copy gt Copy a set of
Download Pdf Manuals
Related Search
Related Contents
TOPO SITE ESCALADE BAIE DE GRESINE, BRISON SAINT Copyright © All rights reserved.
Failed to retrieve file