This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes ANT newbie question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "ANT newbie question" Watch "ANT newbie question" New topic

ANT newbie question

Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
What can ANT (or a script/make file for that matter) do for my project that just using the basic compile in my IDE (IntelliJ) won't do?
I'm asking this question because I have never coded in C or any other language that uses a makefile(so please be gentle). I have about 30 classes that I am working with at the moment. I'm willing to try new tools if they offer an obvious advantage in how I code/distribute code. I looked at the FAQ on the ANT site and read a few articles here, but because they expect most people to know what make files do for you, they usually just talk about the advantages of ANT over make/script files. I really want to know what the advantages of ANT are over a standard IDE compile.
Thanks for your input.
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
If you are only talking about compiling a single piece of code (not part of a large project/stand alone), nothing much. If you are talking building a complex application, then it becomes more clear. It is a tool. All tools have their uses.
Take a look at this thread. It might give you a better understanding.
[ January 13, 2003: Message edited by: Paul Stevens ]
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
Using a build tool (such as Ant) gives you the ability to do everything you need to in one go. For example, I have an ant build file which:
  • compiles all the source files in my project "java" directory and creates a "jar" file of the classes.
  • compiles all the source files in my project "loadable" directory and places the class files in a "classes" directory
  • compiles and runs a complete unit test suite against the classes compiled above.
  • runs a bunch of XML files through an XSLT styleheet to generate nicely decorated HTML
  • builds a complte "war" file from the jar file, loadable classes, generated HTML files, a "web.xml" file and some other resource files.
  • copies the "war" file to a directory monitored by a local test webserver
  • restarts the test server if necessary
  • runs an acceptance test suite against the deployed application
  • transfers the "war" file to a remote server by FTP
  • logs in to the remote server using telnet and restarts its webserver.

  • I can do all this just by typing "ant deploy". If any of the steps fail, the whole process stops with a sensible error message.
    Can your IDE do this, or would you have to do most of it manually?

    Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
    Chris Shepherd
    Ranch Hand

    Joined: Jun 27, 2000
    Posts: 286
    Ah I see... Hmm, I'll have to check out ANT some more that sounds like it would be very useful.
    Thanks to both of you
    I agree. Here's the link:
    subject: ANT newbie question
    It's not a secret anymore!