• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ant and "automatic build" of Eclipse

 
Karim Kiswarday
Ranch Hand
Posts: 50
Eclipse IDE Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

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

Thanks
Karim
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34237
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karim,
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.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18108
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ladislav Lencucha
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic