Is it possible specify Ant listener/logger inside build.xml
, not on a command line?
Asked
Active
Viewed 4,227 times
4 Answers
4
Within the buildfile it's possible to make use of the ant api and create an internal task via scriptdef
.
i.e. implemented with groovy:
http://josefbetancourt.wordpress.com/2011/08/18/buildlistener-groovy-scriptdef/
http://octodecillion.com/blog/buildlistener-groovy-scriptdef/
It's also possible to adjust the loglevel inside the buildfile, see :
https://stackoverflow.com/a/5464009/130683
https://stackoverflow.com/a/5479606/130683
3
It's not in the build file, but you can set the ANT_ARGS env variable to specify the logger

Nate
- 2,407
- 22
- 22
0
<target name="real-build">
<exec dir="${basedir}" executable="${ant.command}" failonerror="true">
<arg line="-f build-all.xml target ${ant.logger}" />
</exec>
</target>

xlecoustillier
- 16,183
- 14
- 60
- 85
-
This is not inside build.xml but opening a new java process with a new ant instance instead, similar to use the command line option -logger .. btw. assuming ${ant.logger} is -logger ... it should be arg line= ${ant.logger} -f ... => ant [options] [target [target2 [target3] ...]], see http://ant.apache.org/manual/running.html#options. – Rebse Jan 25 '13 at 21:13
0
Take a look at the Recorder
task.
http://ant.apache.org/manual/Tasks/recorder.html

MarkOfHall
- 3,334
- 1
- 26
- 30