我有这个:
<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>
我想回应一下“构建路径”引用中的所有内容(用于调试某些内容)。
我试过了:
<echo>${build-path}</echo>
但它只是回复了确切的文字“$ {build-path}”
答案 0 :(得分:54)
你可以使用documented(诚实,它在某处......)toString
帮助者:
<echo message="My build-path is ${toString:build-path}" />
答案 1 :(得分:23)
要调试文件集中包含的文件,您可以使用此示例,该示例以可读格式打印文件集的内容:
<?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
....
答案 2 :(得分:9)
启用ant的调试日志记录:
$ ant -h
ant [options] [target [target2 [target3] ...]]
Options:
...
-verbose, -v be extra verbose
-debug, -d print debugging information
请注意,这会产生大量输出,因此最好将输出捕获到文件中,然后在文本编辑器中找到文件集信息:
ant -debug compile > ant-out.txt