Posted tagged ‘output’

GUI-Output from Apache ant

14. Oktober 2008

This is the first of my Ant snippets. I think I will post more in the future. Most of these snippets are written during discussions on the dev@ant and user@ant mailing lists for showing possibilities or solutions to problems. Sometimes I only played with something …

With <echo> you can print log messages to Ant’s output. I tried to make a „popup“, so you will be informed if a „background“ Ant process has something important to say.

<project>
    <scriptdef name="alert" language="beanshell">
        <attribute name="message"/>
        <attribute name="title"/>
        <!&#91;CDATA&#91;
            title   = attributes.get("title");
            message = attributes.get("message");

            if (title==null) {
                title =  "Ant Alert!";
            }

            import javax.swing.*;
            JOptionPane.showMessageDialog(
                null, message,
                title, JOptionPane.ERROR_MESSAGE);
        &#93;&#93;>
    </scriptdef>

    <alert message="A long and boring message"/>
    <alert message="A long and boring message" title="Danger Danger"/>

</project>