Wyświetlanie zestawu plików ant na ekranie w celu debugowania

Mam to:

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

Chcę odtworzyć wszystko, co jest w referencji "build-path" (do debugowania niektórych rzeczy).

Próbowałem:

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

Ale to tylko echa tego dokładnego tekstu "${build-path} "

 35
Author: systemoutprintln, 2010-10-14

3 answers

Możesz użyć udokumentowanego (szczerze, to gdzieś tam jest...) toString helper:

<echo message="My build-path is ${toString:build-path}" />
 52
Author: martin clayton,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-02-03 15:51:42

Aby debugować, jakie pliki znajdują się w twoim zestawie plików, możesz użyć tego przykładu, który wyświetla zawartość zestawu plików w czytelnym formacie:

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

Wyjście To:

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
....
 22
Author: Frank,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2010-10-21 06:26:12

Enable Ant ' s debug logging:

$ ant -h
ant [options] [target [target2 [target3] ...]]
Options:
...
  -verbose, -v           be extra verbose
  -debug, -d             print debugging information

Zauważ jednak, że wygeneruje to mnóstwo danych wyjściowych, więc najlepiej będzie przechwycić dane wyjściowe do pliku, a następnie znaleźć informacje o zestawie plików w edytorze tekstu:

ant -debug compile > ant-out.txt
 9
Author: matt b,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2010-10-14 14:52:32