Echo target description in Ant

2019-04-19 17:43发布

问题:

<target name="compile" description="Compile the File">
        <echo>Compile the File </echo>
        <mkdir dir="${compilation-dir}" />
        <javac srcdir="." classpath="another2" destdir="${compilation-dir}" />
    </target>

I want to echo the description of the target. Is there a better way of doing this other than duplicating it?

回答1:

I guess this is not a perfect solution, but at least you avoid duplicate descriptions.

<property name="testing.desc" value="this is the desc" />

<target name="testing" description="${testing.desc}">
    <echo message="${testing.desc}" />
</target>


标签: java ant