File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant and Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant and "automatic build" of Eclipse" Watch "Ant and "automatic build" of Eclipse" New topic

Ant and "automatic build" of Eclipse

Karim Kiswarday
Ranch Hand

Joined: Oct 01, 2010
Posts: 50

Hi friends,
I'm new with Ant.

I use Eclipse as IDE and so far, when I save my .java file, Eclipse compiles it automatically.
Now I'm starting to use Ant and I read everywhere to create a task to compile my java files, but I think it's unnecessary in my case.
I think it's useful only when someone doesn't use the "automatic build" during the development.

Can you confirm that?

Are there some cases where is better to disable the automatic build of Eclipse and use Ant?


No fun at the table, no fun in the sack.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33132

If you want the auto build to do something that you can't do in an Eclipse builder. Or if some of the team is using Eclipse and some of the team is using another IDE.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

The Eclipse builders can do basic project build stuff, but not really complex things like constructing a WAR. And, although technically you could gimmick up a set of custom builders to do so, it's a lot easier just to let Ant or Maven do that kind of work.

Eclipse will (by default) automatically compile Java source code when you save it. However it won't automatically do the other things that a complex project requires like building up the WAR's WEB-INF/lib directory, so to get an actual usable WAR (for example), you can run Ant within Eclipse using the Run Ant Eclipse command.

A well-designed project has an Ant build xml that can run either within Eclipse or stand-alone without Eclipse installed. Mostly that just means that the build.xml includes a Java compile task so it doesn't have to depend on Eclipse to do the compiling. Unless it wants to.

An IDE is no substitute for an Intelligent Developer.
Ladislav Lencucha

Joined: Oct 28, 2012
Posts: 2
Actually, Eclipse is able to construct the WAR structure in a very comfortable way. You only have to install the appropriate plugins (or directly download Eclipse for Java EE developer) and choose the correct project type (Dynamic Web Application).

Ant is good as a universal build tool available on every platform without the need of Eclipse beeing installed (ant2 is a 2MB zip file) and able to do execute complex tasks (not only build) and can be easily extended to do almost everything. You can use it to schedule nightly build and all that nice to have stuff.

If you only need to build a web application, Eclipse is enought. If you plan to work in team and do complicated things go for ant, or even better, combine them.
I agree. Here's the link:
subject: Ant and "automatic build" of Eclipse
It's not a secret anymore!