Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将ant文件集回显到屏幕以进行调试_Java_Ant_Ivy - Fatal编程技术网

Java 将ant文件集回显到屏幕以进行调试

Java 将ant文件集回显到屏幕以进行调试,java,ant,ivy,Java,Ant,Ivy,我有这个: <ivy:buildlist reference="build-path"> <fileset dir="${root.dir}"> <include name="*/build.xml" /> <include name="controllers/*/build.xml" /> </fileset> </ivy:build

我有这个:

    <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”引用中的所有内容(用于调试某些东西)

我试过:

<echo>${build-path}</echo>
${build path}

但它只是重复了确切的文本“${build path}”

启用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
您可以使用(老实说,它就在那里的某个地方…
toString
helper:

<echo message="My build-path is ${toString:build-path}" />

要调试文件集中包含的文件,可以使用以下示例,该示例以可读格式打印文件集的内容:

<?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>

它曾经是一种非正式的黑客行为。。。不过,它是完全“正式化”的,并为Ant 1.8.1编写了文档。谢谢,我知道有类似的情况,但搜索文档有点痛苦。。。已接近编写我自己的任务。请注意,如果使用而不使用“property”属性,则会打印到stdout/console,以便使用更简洁的语法。
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
....