is there a way to set ant -verbose inside build.xml?

白昼怎懂夜的黑 提交于 2019-12-29 18:50:31

问题


I would like to get verbose console output while building from eclipse and hudson.

There seems to be no verbose property for <target> and <project> and it seems very wrong to call <exec> on ant from inside the script just to pass the verbose prop.

Is there a better way?


回答1:


It will be an eclipse External Tools Configuration parameter (under Run -> External Tools). Please see the screenshot below:




回答2:


You could use Ant's <record> task (http://ant.apache.org/manual/Tasks/recorder.html) to get verbose logging to a file. If this task is defined early in the build file, you should get logging for all build tasks. You could also start and stop the recorder anywhere in your build file. This could, for example, allow you to not log the output of some task that you do not want to see in the log file.

Here's an example of a simple build file that uses the <record> task:

<?xml version="1.0" encoding="UTF-8"?>
<project default="all" basedir=".">
  <record name="build.log" loglevel="verbose" action="start" />
  <target name="all">
    <path id="all.files">
      <fileset dir="." includes="**/*" />
    </path>
    <property name="files" refid="all.files" />
    <echo level="verbose">files=${files}</echo>
  </target>
</project>


来源:https://stackoverflow.com/questions/5232168/is-there-a-way-to-set-ant-verbose-inside-build-xml

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