• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ant vs Batch files

 
Naren Chivukula
Ranch Hand
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can anyone tell me what all we can do using Ant that can't be done using batch files? As I'm new to Ant tool, tell me the areas where Ant is powerful compared to batch files

Regards,
Narendranath
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34073
335
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Naren,
A few advantages of Ant over batch files:
  • platform independence - you can develop on Windows and run a build on UNIX/LINUX
  • integrates into IDEs - you can run the build from the IDE or command line
  • knowledge - more people know Ant than advanced batch scripting
  • support - since Ant is standard, there are many extensions and custom tasks
  • more powerful tasks - how easy is it to send out an e-mail in a batch file?

  •  
    Ilja Preuss
    author
    Sheriff
    Posts: 14112
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Naren Chivukula:
    Can anyone tell me what all we can do using Ant that can't be done using batch files?


    Nothing, in the same sense as that you can't do anything in Java that couldn't be done using Assembler instead.
     
    Tim Holloway
    Saloon Keeper
    Pie
    Posts: 17989
    47
    Android Eclipse IDE Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    More accurately, there's a whole raft of things that are trivial in Ant that are difficult or even impossible in that rather feeble scripting language used for Windows batch files (I'm assuming that's what you meant and not the more powerful Unix shell scripting, though Ant has advantages even there).

    Just aside from providing an intelligent and extensible build environment for Java, Ant scripts also have minimal OS dependency. If you want to create or delete a directory, for example, the same Ant task works under both Windows and Unix.

    I have, in fact, some ant buildfiles that allow me to do development under Windows, then export the entire project to Solaris, where I rerun them and they detect the Solaris OS and build Solaris install packages. One of my projects also understands that when it's running under Linux, it's supposed to build an RPM.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic