Is it possible to execute an apply on a file set and have ant print the command it is executing?
For example:
<target name="test">
<apply executable="ls" failonerror="true" verbose="true" ignoremissing="false">
<fileset dir=".">
<include name="*.xml" />
</fileset>
<arg line="-la" />
</apply>
</target>
I would like the output to be something close to the following, with the key line being:
[apply] ls -la ./build.xml"
E.g.
Buildfile: /home/abarker/NetBeansProjects/TestProject/build.xml
test:
[apply] ls -la ./build.xml
[apply] -rw-r--r-- 1 abarker abarker 29231 Feb 13 11:29 /home/abarker/NetBeansProjects/TestProject/build.xml
[apply] Applied ls to 1 file and 0 directories.
There are several ideas I have:
You can use the
outputpropertyparameter. This will give you the output of the command in the<apply>task.You can use fileset reference instead of an actual fileset.
Like this:
You can then look at the fileset reference
apply.filesto see what files the<apply>task is operating on.You can always add the
-debugand-verboseflag when you run ant. This will print exactly what you want and then some — then some a whole lot. I wish there was a way to turn verbose mode on and off on a particular task, but I don’t know how to do that — at least an easy way to do that.