回声ant文件集屏幕进行debugging
我有这个:
<ivy:buildlist reference="build-path"> <fileset dir="${root.dir}"> <include name="*/build.xml" /> <include name="controllers/*/build.xml" /> </fileset> </ivy:buildlist> <subant buildpathref="build-path"> <target name="jar.all" /> <target name="publish-local" /> </subant>
我想要回显“构buildpath”参考中的所有内容(用于debugging某些内容)。
我努力了:
<echo>${build-path}</echo>
但它只是回声确切的文字“$ {build-path}”
你可以使用logging (诚实,它在那里…) toString
帮手:
<echo message="My build-path is ${toString:build-path}" />
要debugging文件集中包含哪些文件,可以使用此示例以可读的格式打印文件集的内容:
<?xml version="1.0" encoding="UTF-8"?> <project name="de.foo.ant" basedir="."> <!-- Print path manually --> <target name="print-path-manually" description="" > <path id="example.path"> <fileset dir="${ant.library.dir}"/> </path> <!-- Format path --> <pathconvert pathsep="${line.separator}| |-- " property="echo.path.compile" refid="example.path"> </pathconvert> <echo>${echo.path.compile}</echo> </target> </project>
这个输出是:
Buildfile: D:\Workspaces\IvyTutorial\de.foo.ant\prettyPrintPath.xml print-path-manually: [echo] D:\Programme\eclipse-rcp-helios-SR1-win32\eclipse\plugins\org.apache.ant_1.7.1.v20100518-1145\lib\ant-antlr.jar [echo] | |-- D:\Programme\eclipse-rcp-helios-SR1-win32\eclipse\plugins\org.apache.ant_1.7.1.v20100518-1145\lib\ant-apache-bcel.jar [echo] | |-- D:\Programme\eclipse-rcp-helios-SR1-win32\eclipse\plugins\org.apache.ant_1.7.1.v20100518-1145\lib\ant-apache-bsf.jar [echo] | |-- D:\Programme\eclipse-rcp-helios-SR1-win32\eclipse\plugins\org.apache.ant_1.7.1.v20100518-1145\lib\ant-apache-log4j.jar [echo] | |-- D:\Programme\eclipse-rcp-helios-SR1-win32\eclipse\plugins\org.apache.ant_1.7.1.v20100518-1145\lib\ant-apache-oro.jar [echo] | |-- D:\Programme\eclipse-rcp-helios-SR1-win32\eclipse\plugins\org.apache.ant_1.7.1.v20100518-1145\lib\ant-apache-regexp.jar [echo] | |-- D:\Programme\eclipse-rcp-helios-SR1-win32\eclipse\plugins\org.apache.ant_1.7.1.v20100518-1145\lib\ant-apache-resolver.jar ....
启用ant的debugging日志logging:
$ ant -h ant [options] [target [target2 [target3] ...]] Options: ... -verbose, -v be extra verbose -debug, -d print debugging information
请注意,这将产生大量的输出,因此最好将输出捕获到文件中,然后在文本编辑器中查找文件集信息:
ant -debug compile > ant-out.txt