Is there a way to specify an ANT file to run only one/some/all of its sections?
Split your build into appropriate targets so that you can call individual targets separately, and then you can specify the target you want to run from the command line.
Personally I like having "real" targets without any dependencies (which I can run independently) and then "fake" targets which are just dependent on the real ones, for convenience (e.g. "clean-build"). The alternative of having test depend on compile etc always ends up getting in the way for me :(
You can group targets together using dependencies:
<target name="A">
<target name="B">
<target name="C" depends="A,B">
runs A, B, then C.
You can also chain these to arbitrary depth. For example you could create an empty target "D" that depends on A, B which will only run A and B.
<project....
<target name="all">
...
</target>
<target name="some">
...
</target>
</project>
run
ant all
or
ant some
Define appropriate targets in your build file and then run
ant 'target name'
to run that particular one. You will have to configure target dependencies such that the ones you want to run separately can do so correctly.
It's a good practise to define these top-level targets with a description.
<target name="clean" description="Cleans up built artifacts">
Then you can run
ant -projecthelp
and this will display the targets with descriptions, thus telling you what targets are available. This will make life a lot easier further down the road, when you've forgotten what targets you've defined.