ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas Lalevée <>
Subject Re: Command Line Debugging
Date Thu, 09 Jun 2011 09:42:35 GMT
This is looking great ! At some point we may imagine a debugger in an IDE like Eclipse too.
This seems a nice first step.

About the implementation, I think you don't need to patch ant for that. At least for a first
If you implement a listener (see, I think you will be
able to pause the execution of the targets.

Then rather than adding some new command line argument, you could setup some "magic" ant property.
For instance "".

So the command line could look line:
ant -listener org.apache.ant.debugger.DebuggerListener

Then if the ant developer community likes it, we could modify ant Main class to add a new
command line option which will be a shortcut for the above arguments.


Le 7 juin 2011 à 11:40, Purkayastha, Siddhartha a écrit :

> Hello -
> In case you have not had an occassion to go through the original mail, the idea is to
build a command line utility that will allow the user to pause the build execution (similar
to a break-point), and allow the user to inspect the status of the build. For example, what
is the value of a property, what is the value of a path, where do I find the declaration of
a property a.b.c. 
> The sources for the POC may be found at this location:
The patch sub-directory has a patch of the implementation.
> You could try this on the Ant build.xml itself. Something like this:
>    ant -breakAt dist-lite
> The build pauses and presents a prompt to the end user asking for a command to run. Here
are somethings you could try:
>    locate property Should give you the declaration of the property inside
the build file
>    inspect property Should give you the current value of the property
>    inspect path some.path: Should give you the current value of the path
>    return: Returns from the prompt and resumes the build
> Here is a sample output from a run of my local setup:
>  :
> test-jar:
>      [jar] Building jar: D:\sandboxes\ant-svn\build\lib\ant-testutil.jar
> -internal-debugger:
> -------- Ant Command Line Debugger --------
> [Debugger] DEBUGGER>
> locate property Name
> Detected a property by name [Name]. Build file value: Apache Ant
> Located at: D:\sandboxes\ant-svn\build.xml:33:
> [Debugger] DEBUGGER>
> inspect property tests-classpath
> Found no such property.
> [Debugger] DEBUGGER>
> inspect path tests-classpath
> [pathconvert] D:\sandboxes\ant-svn\build\classes
> [pathconvert]     - D:\sandboxes\ant-svn\lib\optional\ant-antunit-1.1.jar
> [pathconvert]     - D:\sandboxes\ant-svn\lib\optional\junit-3.8.2.jar
> [pathconvert]     - D:\sandboxes\ant-svn\lib\optional\junit-4.8.1.jar
> [Debugger] DEBUGGER>
> --------- Resuming Ant Execution ----------
> What do you think about the utility of such a tool?
> Thanks,
> Siddhartha
> ________________________________
> From: Jean-Louis Boudart []
> Sent: Mon 6/6/2011 9:09 PM
> To:; Ant Developers List
> Subject: Re: Command Line Debugging
> The idea really looks like promising.
> I think this feature could have a better place in ant itself (i'm adding
> them in copy of this email).
> Could you share the code of your POC somewhere with some guide line to test
> it?  I'm  pretty sure people will have ideas when they will try it. If you
> need a place to publish it you can use this :
> 2011/5/29 Purkayastha, Siddhartha <>
>> Hello All -
>> I wanted to discuss an idea with you about diagnostics. When considering
>> about diagnostics, it should comprise of a set of tools that can help me
>> diagnose issues I am facing with my build. Ant -diagnostics returns lots of
>> variables that can be valuable to resolving environment / setup issues.
>> I am thinking of the possibility of a Command Line Debugger / Inspector
>> included within EasyAnt (or may be even Ant itself). I am not aware if such
>> a tool already exists.
>> It could behave something like this:
>> I can run:
>>            ant -breakAt=someTarget
>> The breakAt parameter could indicate a breakpoint at target 'someTarget'.
>> The user could be interactively displayed a prompt here:
>>       breakpoint:
>>        [Debugger] DEBUGGER>
>> Where the user could issue a set of commands to inspect the state of the
>> build so far.
>> For example:
>>        breakpoint:
>>                [Debugger] DEBUGGER> inspect
>>               Property Value: HelloWorld
>> The same idea could be extended to include other build factors, like paths,
>> imported plugins etc. It may actually be extended to become a fully featured
>> command line debugger, from where one can also set new property values or
>> override existing values (probably a relaxation of immutability for the
>> support of this tool) etc, do step over, step into etc.
>> I did some experiments with this concept, I was able to break at a certain
>> target and inspect values of properties that user wants to see, using a new
>> target created at Runtime, with a single task that accepted user inputs from
>> command line, interpreted it and displayed an output - And kept on doing so
>> till the user typed 'return' on the prompt. I also think, as an extension -
>> if we can also track audit history of different properties, paths,
>> references etc, then this could be an effective tool. However, I do not
>> think it is easily achievable today.
>> I am wondering about the technical feasibility and utility of such an
>> inbuilt tool. Can you share your thoughts on this?
>> Thanks,
>> Siddhartha
> --
> Jean Louis Boudart
> Independent consultant
> Project Lead <> 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message