I have a Java project, with the standard Java Builder selected as it's sole builder. Also, the build is configured to build automatically.
What I would like to understand is the resulting build circumstances when I add an ant build to this project (project -> properties -> builders
). What I would expect, is that everytime I make a change to my Java source, both the Java Builder and my ant build will run, but it doesn't seem that my ant build runs.
When I first add the ant build, it runs, i.e I see the output in the console. However, when I then make changes to my source files, it doesn't run again, i.e. I don't see output in the console. I know that the Java Builder is still running due to the fact that my changes have entered into Eclipses code awareness, i.e. I can reference those changes from other classes, etc.
Note, if I manually invoke the build, i.e. via Project -> Build All
, the ant build runs, i.e. I see the output in the console again.
So, why doesn't the ant build I've added run with the automatic building? Note, I wouldn't necessarily expect it to be able to do incremental work, since it's not made for that, but I would have thought it would fire off when the Java Builder fires off? Am I missing something?
The ant builder, or any other builder for that matter, have several methods for building a project. When a build occurs in the Eclipse, the
build(int kind, Map<String, String> args, IProgressMonitor monitor)
method of all the active builders is called, but, there are different kinds of build, that any builder checks for in thebuild
method. The kinds of build are:Here is an example syntax of build:
As you can see, a builder can decide to react to a certain kind of build, and even act differently for different build kinds, so, my guess is, the ant builder is implemented so that it only reacts to full build, and not incremental build.
Did you configure your Ant builder to run during an "auto" build? To do so, select the properties of the builder, go to the
Targets
page and useSet Targets
forAuto Build
.I have an Ant builder that is running in my Eclipse project on all kinds of builds (so also on saving edited source files), and I don't remember changing anything else.