
listener.MailLogger − Extends DefaultLogger such that output is still generated the same, and when the build is finished an e-mail can be sent. NoBannerLogger − This logger omits output of empty target output. DefaultLogger − The logger used implicitly unless overridden with the -logger command-line switch. Loggers extends listeners capabilities and add the following featuresĬan log information to console or file using -logfile argumentĬan log using logging levels like -quiet, -verbose, -debug ListenersĪnt provides following events to be captured using listeners.Ĭustom listeners can be registered on command line using -listener argument. Pass the batch files (plus any arguments to the script) as a single command, using /c switch.Ant allows the build process to be monitored using listeners and loggers. Pass the shell script (plus any arguments to the script) as a single command, using -c switch. On systems running a Unix-type shell (for example, Cygwin on Windows) execute the (command) shell To summarize,on native UNIX systems, you should be able to run shell scripts directly. Execute the ant command and the output should be:.Copy the build.xml and test.bat (attached below), to your C: directory.Now open the command prompt,cursor pointing to C:\>.When the os attribute is specified, then the command is only executed when Apache Ant is run on one of the specified operating systems :įollowing is to run a shell script on UNIX using Ant task: To execute a script, exec command is used wrapped inside your target definition. If this condition returns true, then runscript.unix will be called.įollowing is how you can define an ant task to execute a batch script on windows: Returns true, then ant target runscript.windows is executed.Įlse, ifOSNotWindows is tested using isOSUnix property: We can see that, ifOSWindows and ifOSNotWindows are based on a condition, which if true calls the specific target. This target depends on targets ifOSWindows and ifOSNotWindows. Now we need an ant task in build file, to call the appropriate scripts depending on the operating system.

Let’s assume we have two scripts, one (.bat file) which executes on windows operating system family, and other (.sh) that runs on all non-windows platforms like UNIX, Linux, etc.
