Reputation: 43
I am trying to get the output of an Ant execution command into an output property and echo that property. We should be able to view the output of the command. I have used the below code, but I am not able to view the output of the Ant execution.
<exec executable="${exe.baroverride}"
spawn="false"
failonerror="true"
>
<redirector outputproperty="baroverride.out"
errorproperty="baroverride.err"/>
</exec>
<logmsg message="Bar Override Output for the bar file ${iib.build.target.bar.filename} ${baroverride.out}"/>
Upvotes: 4
Views: 4278
Reputation: 7041
First, there is no <logmsg>
task included with Ant. <logmsg>
may be from a custom <macrodef>
or <taskdef>
. We won't be able to help you with how <logmsg>
works unless you provide the code for it.
Second, the <redirector>
splits the output into two properties...
<redirector outputproperty="baroverride.out"
errorproperty="baroverride.err"/>
...however, the <logmsg>
call only references baroverride.out
...
<logmsg message="... ${baroverride.out}"/>
If <exec>
wrote to baroverride.err
, the above <logmsg>
call won't show it.
Consider deleting the <redirector>
altogether and use the outputproperty
attribute of <exec>
instead...
<exec executable="${exe.baroverride}"
spawn="false"
failonerror="true"
outputproperty="baroverride.out"
/>
<echo>baroverride.out: ${baroverride.out}</echo>
Upvotes: 1