【发布时间】:2011-04-19 19:20:02
【问题描述】:
是否可以在 build.xml 中指定 Ant listener/logger,而不是在命令行上?
【问题讨论】:
标签: ant
是否可以在 build.xml 中指定 Ant listener/logger,而不是在命令行上?
【问题讨论】:
标签: ant
在构建文件中,可以使用 ant api 并通过 scriptdef 创建内部任务。
即用 groovy 实现:
http://josefbetancourt.wordpress.com/2011/08/18/buildlistener-groovy-scriptdef/
http://octodecillion.com/blog/buildlistener-groovy-scriptdef/
还可以调整构建文件中的日志级别,请参阅:
https://stackoverflow.com/a/5464009/130683
https://stackoverflow.com/a/5479606/130683
【讨论】:
它不在构建文件中,但您可以设置 ANT_ARGS 环境变量来指定记录器
【讨论】:
看看Recorder 任务。
http://ant.apache.org/manual/Tasks/recorder.html
【讨论】:
<target name="real-build">
<exec dir="${basedir}" executable="${ant.command}" failonerror="true">
<arg line="-f build-all.xml target ${ant.logger}" />
</exec>
</target>
【讨论】: