Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Echo target description in Ant

Tags:

java

ant

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

like image 253
unj2 Avatar asked May 02 '10 19:05

unj2


People also ask

What is echo in Ant?

Echoes a message to the current loggers and listeners which means System. out unless overridden. A level can be specified, which controls at what logging level the message is filtered at.

What are targets in Ant?

An Ant target is a sequence of tasks to be executed to perform a part (or whole) of the build process. Ant targets are defined by the user of Ant. Thus, what tasks an Ant target contains depends on what the user of Ant is trying to do in the build script.

How do I run a specific target in Ant?

To run the ant build file, open up command prompt and navigate to the folder, where the build. xml resides, and then type ant info. You could also type ant instead. Both will work,because info is the default target in the build file.

What is the default target in Ant?

the default target to use when no target is supplied. No; however, since Ant 1.6. 0, every project includes an implicit target that contains any and all top-level tasks and/or types. This target will always be executed as part of the project's initialization, even when Ant is run with the -projecthelp option.


1 Answers

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>
like image 95
Jarle Hansen Avatar answered Sep 26 '22 02:09

Jarle Hansen