Is it possible specify Ant listener/logger inside build.xml
, not on a command line?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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
回答2:
It's not in the build file, but you can set the ANT_ARGS env variable to specify the logger
http://wiki.apache.org/ant/TheElementsOfAntStyle
回答3:
Take a look at the Recorder
task.
http://ant.apache.org/manual/Tasks/recorder.html
回答4:
<target name="real-build">
<exec dir="${basedir}" executable="${ant.command}" failonerror="true">
<arg line="-f build-all.xml target ${ant.logger}" />
</exec>
</target>