Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

AntForm and AntMenu for Apache Ant: Installation, Usage, and Practical XML Examples

AntForm and AntMenu are Java-based extensions for Apache Ant that add interactive GUI screens to command-driven build workflows. If you maintain legacy Ant build files, this guide will help you understand the two tasks, define them correctly, and run working examples with minimal trial and error.

Originally published on 2009-10-06; fully revised and updated.

AntForm and AntMenu screenshot

What AntForm and AntMenu do

Apache Ant is widely used in Java build and automation pipelines. AntForm and AntMenu extend Ant with GUI-driven interaction for cases where runtime user input is required.

  • AntForm: Shows a Swing form so users can enter or select values that are written into Ant properties.
  • AntMenu: Shows a button-style menu that launches selected Ant targets.

In short, AntForm focuses on collecting properties, while AntMenu focuses on navigating and launching targets.

AntForm vs AntMenu at a glance

TaskPrimary purposeUser interactionTypical outputBest use case
antformCapture property valuesForm fields (text, selection, boolean, multiline)Ant properties set at runtime, optionally saved to a properties fileBuild or deploy flows where user input drives later targets
antmenuLaunch targets from a menuButtons and links mapped to targetsExecution of selected Ant targetsOperator-facing entry points for multi-target build scripts

Typical execution flow in an Ant build

flowchart TD
    A[Run ant target] --> B[Load task definitions]
    B --> C{Which task runs}
    C -- antform --> D[Show Swing form]
    D --> E[User submits values]
    E --> F[Set Ant properties]
    C -- antmenu --> G[Show button menu]
    G --> H[User chooses target]
    H --> I[Run selected target]
    F --> I

This flow is useful when a script cannot be fully non-interactive and needs guided, structured user input.

Installation and task definition

After downloading the package, extract it to a directory such as antform.home. Then define tasks in your Ant build file so Ant can load classes from antform.jar.

<taskdef name="antform" classname="com.sardak.antform.AntForm"
         classpath="${antform.home}/lib/antform.jar"/>

<taskdef name="antmenu" classname="com.sardak.antform.AntMenu"
         classpath="${antform.home}/lib/antform.jar"/>Code language: HTML, XML (xml)

You can also load the provided task definitions resource instead of defining each task explicitly:

<taskdef resource="com/sardak/antform/taskdefs.properties"
         classpath="${antform.home}/lib/antform.jar"/>Code language: HTML, XML (xml)

If antform.jar is copied into ${ant_home}/lib, explicit classpath references may not be required for each task definition.

Running the provided sample targets

The original package includes a sample build file named test.xml. With Ant and PATH configured, run:

ant -f test.xml test testmenu testne spinners password wizard1Code language: CSS (css)

To list available sample targets:

ant -f test.xml -pCode language: CSS (css)

Example: AntForm task for mail-style input

This sample form collects recipient, subject, message body, and a send flag, then stores values as Ant properties.

<antform title="Send Mail"
         save="properties.txt"
         image="doc/images/testlogo.jpg">
    <label>To send a mail, use the following form. Pick a recipient, type a subject and a body...the script will do the rest.</label>

    <selectionProperty label="Recipient: "
                       property="recipient"
                       values="address1@somewhere.com; address2@somewhere.com; address4@somewhere.com"
                       separator=";"/>

    <textProperty label="Subject : " property="subject"/>

    <multilineTextProperty label="Message body: "
                           property="body"/>

    <booleanProperty label="Send immediately: " property="send"/>
</antform>Code language: HTML, XML (xml)

Example: AntMenu task for target navigation

This sample defines a vertical menu that launches specific test targets.

<antmenu image="doc/images/logo-small.jpg"
         title="AntForm and AntMenu tests">

    <AntMenuItem name="AntMenu Tests">
        <AntMenuItem name="Mail-type form" target="test"/>
        <AntMenuItem name="Spinners and dateProperty test" target="spinners"/>
        <AntMenuItem name="Test non-editable properties" target="testne"/>
        <AntMenuItem name="Login and password test" target="password"/>
        <AntMenuItem name="AntForm with inner menu test" target="afm"/>
        <AntMenuItem name="Wizards test" target="wizard1"/>
    </AntMenuItem>

    <AntMenuItem name="AntMenu tests">
        <AntMenuItem name="This test" target="testmenu"/>
    </AntMenuItem>

    <label>A short label with a few explanatory words concerning the menu at hand.</label>
    <link label="Echo 1 target" target="echo1"/>
    <link label="Echo 2 target" target="echo2"/>
    <link label="Echo 3 target" target="echo3"/>
    <link label="End" target="end"/>

</antmenu>Code language: HTML, XML (xml)

Best practices for legacy Ant GUI tasks

  • Keep AntForm and AntMenu usage limited to workflows that genuinely need operator input.
  • Store reusable defaults in properties files, then override only what users must change.
  • Use clear labels and predictable target names to reduce operator mistakes.
  • Test in an environment with desktop UI support, since AntForm uses Swing components.
  • Document a non-GUI fallback target when possible for automation and CI jobs.

More information: http://antforms.sourceforge.net/

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Team Foundation Build 2010: Architecture, Build Definitions, and Migration from TFS 2008

Team Foundation Build 2010 introduced a controller/agent build architecture, richer build definitions, and gated check-in workflows for TFS teams. This revised guide turns the original topic list into a practical reference for setup, customization, and migration planning.

Read More

Team Foundation Server 2015: Practical Guide to Planning, Git, Builds, Testing, and Integrations

This guide turns an outline-style TFS 2015 post into a practical reference for real delivery workflows. Learn how to connect Agile planning, version control, CI builds, testing, and integrations in one on-prem pipeline.

Read More

Docker Training Agenda: A Hands-On Learning Path from Containers to Registries and Networking

This revised Docker training agenda turns the original outline into a practical, modern learning path for beginners and early-career DevOps engineers. It maps each module to hands-on outcomes, core commands, and common implementation decisions.

Read More

DevOps Training in Hyderabad: How to Evaluate Programs (with Legacy scmGalaxy Links)

This revised guide turns a legacy promotional post into a practical framework for choosing a DevOps training program in Hyderabad or online. It includes verification checklists, delivery model comparisons, and hands-on lab examples to assess course quality.

Read More

Puppet Training Agenda: A Practical Roadmap from Basics to Real-World Automation

This revised guide converts the original Puppet course outline into a clear learning path for DevOps and platform teams. It covers architecture, run cycle, hands-on manifests, ecosystem tools, and common implementation pitfalls.

Read More

Chef Training Roadmap for DevOps Engineers: Course Tracks, Lab Workflow, and Practical Commands

This guide turns a promotional Chef training post into a practical roadmap for engineers. Compare course levels, understand the learning workflow, and use hands-on commands you can run in a lab.

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x