I would like to know about the debugging capabilities of ANT using eclipse. Basically I have an ANT build script written by a colleague and I wanted to step through each target to see what are the various tasks that are beings called.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Create a script
antdebug.sh
which sets the environment variableANT_OPTS
before starting antAfterwards you can remote attach to it using your IDE. Please note the
suspend=y
, it will suspend the execution until you are attached.Before you dive deep into Ant internals, it may be worth trying to run the script with -d (debug) flag and observe the output. Assuming that you are interested in understand how the particular Ant script is working (or not working) and not Ant itself.
If Ant is your area of interest, the answers above are the direction to follow.
You can do this in Eclipse with these steps:
add below xml tag to ant
build.xml
after target initif the javac is already there make sure to add
debug="true" debuglevel="lines,vars,source"
to have a interactive debug session.Since ant is just a Java application, you can just add a debug configuration (type Java Application) to eclipse. See Running Ant via Java for how to invoke Ant as if it were a Java application. I'll assume you know how to debug a Java app in Eclipse, so that should get you the rest of the way. If not, ask and I'll expand on this.
With large ant files, or large java projects, when we may have multiple ant files calling each other, I've found that a dependency graph is very useful. I've used Grand to this purpose.
Of course, this will not help much if you want to debug the sequence of instructions inside a particular target.