# apache/ant architecture

> Architecture diagram of the GitHub repository apache/ant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/apache/ant
- Repository: https://github.com/apache/ant

## Overview

Apache Ant is a portable, Java-based build tool: users invoke it with command-line options and an XML build file; Ant parses the file into targets and tasks, orders targets by dependencies, and executes task objects to produce build artifacts or invoke external tools. The graph preserves the documented execution model and major task families, plus core project, property, and input layers. Several task subsystems are unsampled, so their connections are shown as unverified rather than inferred as a call chain.

Main entry points: [`src/main/org/apache/tools/ant/Task.java`](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/Task.java) (Task runtime), [`src/main/org/apache/tools/ant/Project.java`](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/Project.java) (Project state), [`src/main/org/apache/tools/ant/Main.java`](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/Main.java) (Command line), [`src/main/org/apache/tools/ant/ProjectHelper.java`](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/ProjectHelper.java) (Project helper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Invocation and parsing"]
  node_cli["Command line<br/>[Main.java]"]
  node_buildfile["XML build file"]
  node_helper["Project helper<br/>[ProjectHelper.java]"]
  node_helperrepo["Helper registry"]
end

subgraph group_model["Build model"]
  node_project["Project state<br/>[Project.java]"]
  node_properties["Property resolution"]
  node_targets["Target graph<br/>[Target.java]"]
  node_elements["Configured elements"]
end

subgraph group_execution["Execution"]
  node_task["Task runtime<br/>[Task.java]"]
  node_input["Input handling"]
end

subgraph group_tasks["Build capabilities"]
  node_fileops["File operations<br/>[Copy.java]"]
  node_compile["Java compilation<br/>[Javac.java]"]
  node_archive["Packaging<br/>[Jar.java]"]
  node_external["External commands<br/>[Exec.java]"]
  node_integrations["Optional integrations"]
end

subgraph group_core["Shared runtime"]
  node_errors["Build errors"]
  node_files["File selection<br/>[Files.java]"]
  node_fileutils["File utilities<br/>[FileUtils.java]"]
end

node_user(("Build author"))
node_actorinput(("Interactive user"))

node_user -->|"invokes"| node_cli
node_user -->|"defines"| node_buildfile
node_cli -->|"starts"| node_project
node_cli -->|"configures"| node_input
node_project -->|"selects parser"| node_helperrepo
node_helperrepo -->|"registers helpers"| node_helper
node_helper -->|"parses"| node_buildfile
node_helper -->|"configures"| node_project
node_project -->|"orders dependencies"| node_targets
node_project -->|"uses properties"| node_properties
node_project -->|"uses resources"| node_files
node_targets -->|"executes tasks"| node_task
node_task -->|"configures"| node_elements
node_task -->|"raises"| node_errors
node_input -->|"prompts"| node_actorinput
node_task -.->|"dispatches task"| node_fileops
node_task -.->|"dispatches task"| node_compile
node_task -.->|"dispatches task"| node_archive
node_task -.->|"dispatches task"| node_external
node_task -.->|"dispatches task"| node_integrations
node_fileops -.->|"uses utilities"| node_fileutils
node_fileops -.->|"selects files"| node_files

click node_cli "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/Main.java"
click node_helper "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/ProjectHelper.java"
click node_helperrepo "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/ProjectHelperRepository.java"
click node_project "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/Project.java"
click node_properties "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/PropertyHelper.java"
click node_targets "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/Target.java"
click node_elements "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/UnknownElement.java"
click node_task "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/Task.java"
click node_input "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/input/DefaultInputHandler.java"
click node_fileops "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Copy.java"
click node_compile "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Javac.java"
click node_archive "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Jar.java"
click node_external "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Exec.java"
click node_integrations "https://github.com/apache/ant/tree/master/src/main/org/apache/tools/ant/taskdefs/optional"
click node_errors "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/BuildException.java"
click node_files "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/types/resources/Files.java"
click node_fileutils "https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/util/FileUtils.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_buildfile,node_helper,node_helperrepo,node_actorinput toneBlue
class node_project,node_properties,node_targets,node_elements toneAmber
class node_task,node_input toneMint
class node_fileops,node_compile,node_archive,node_external,node_integrations toneRose
class node_errors,node_files,node_fileutils,node_user toneIndigo
```

## Components

### Invocation and parsing

- [Command line](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/Main.java): `src/main/org/apache/tools/ant/Main.java`
- **XML build file**
- [Project helper](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/ProjectHelper.java): `src/main/org/apache/tools/ant/ProjectHelper.java`
- [Helper registry](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/ProjectHelperRepository.java): `src/main/org/apache/tools/ant/ProjectHelperRepository.java`

### Build model

- [Project state](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/Project.java): `src/main/org/apache/tools/ant/Project.java`
- [Property resolution](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/PropertyHelper.java): `src/main/org/apache/tools/ant/PropertyHelper.java`
- [Target graph](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/Target.java): `src/main/org/apache/tools/ant/Target.java`
- [Configured elements](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/UnknownElement.java): `src/main/org/apache/tools/ant/UnknownElement.java`

### Execution

- [Task runtime](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/Task.java): `src/main/org/apache/tools/ant/Task.java`
- [Input handling](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/input/DefaultInputHandler.java): `src/main/org/apache/tools/ant/input/DefaultInputHandler.java`

### Build capabilities

- [File operations](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Copy.java): `src/main/org/apache/tools/ant/taskdefs/Copy.java`
- [Java compilation](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Javac.java): `src/main/org/apache/tools/ant/taskdefs/Javac.java`
- [Packaging](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Jar.java): `src/main/org/apache/tools/ant/taskdefs/Jar.java`
- [External commands](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Exec.java): `src/main/org/apache/tools/ant/taskdefs/Exec.java`
- [Optional integrations](https://github.com/apache/ant/tree/master/src/main/org/apache/tools/ant/taskdefs/optional): `src/main/org/apache/tools/ant/taskdefs/optional`

### Shared runtime

- [Build errors](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/BuildException.java): `src/main/org/apache/tools/ant/BuildException.java`
- [File selection](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/types/resources/Files.java): `src/main/org/apache/tools/ant/types/resources/Files.java`
- [File utilities](https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/util/FileUtils.java): `src/main/org/apache/tools/ant/util/FileUtils.java`

### Other components

- **Build author**
- **Interactive user**

## Connections

- Build author → Command line: invokes (evidence: `README`)
- Build author → XML build file: defines (evidence: `README`)
- Command line → Project state: starts (evidence: `src/main/org/apache/tools/ant/Main.java`)
- Command line → Input handling: configures (evidence: `src/main/org/apache/tools/ant/Main.java`)
- Project state → Helper registry: selects parser (evidence: `src/main/org/apache/tools/ant/ProjectHelper.java`)
- Helper registry → Project helper: registers helpers (evidence: `src/main/org/apache/tools/ant/ProjectHelperRepository.java`)
- Project helper → XML build file: parses (evidence: `src/main/org/apache/tools/ant/ProjectHelper.java`)
- Project helper → Project state: configures (evidence: `src/main/org/apache/tools/ant/ProjectHelper.java`)
- Project state → Target graph: orders dependencies (evidence: `src/main/org/apache/tools/ant/Project.java`)
- Project state → Property resolution: uses properties (evidence: `src/main/org/apache/tools/ant/Project.java`)
- Project state → File selection: uses resources (evidence: `src/main/org/apache/tools/ant/Project.java`)
- Target graph → Task runtime: executes tasks (evidence: `README`)
- Task runtime → Configured elements: configures (evidence: `src/main/org/apache/tools/ant/Task.java`)
- Task runtime → Build errors: raises (evidence: `src/main/org/apache/tools/ant/Task.java`)
- Input handling → Interactive user: prompts (evidence: `src/main/org/apache/tools/ant/input/DefaultInputHandler.java`)
- Task runtime → File operations: dispatches task
- Task runtime → Java compilation: dispatches task
- Task runtime → Packaging: dispatches task
- Task runtime → External commands: dispatches task (evidence: `README`)
- Task runtime → Optional integrations: dispatches task (evidence: `src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java`)
- File operations → File utilities: uses utilities
- File operations → File selection: selects files
