Is it possible to specify logger for ant inside build.xml?

白昼怎懂夜的黑 提交于 2019-12-18 05:57:45

问题


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>


来源:https://stackoverflow.com/questions/5721513/is-it-possible-to-specify-logger-for-ant-inside-build-xml

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!