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?
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.
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.