Browse Ant build files from a dedicated sidebar and run their targets directly from VS Code.
For Java projects, it can also generate Eclipse .classpath files so the Java language server
(eclipse.jdt.ls) resolves the same classpath that Ant compiles with.
Ant Workbench gives you a unified sidebar for all Ant build files in your workspace. You can browse targets, run them with a single click, and manage multiple build files per folder — without leaving VS Code.
Note
Symptom — your project uses Language Support for Java, and you see red squiggles even though the project builds fine with Ant.
This often happens with projects that carry a stale or incompatible .classpath — for example,
projects exported from Eclipse that contain server-runtime containers, workspace-relative
variables, or outdated project references that VS Code cannot resolve.
The fix: Ant Workbench treats the build file as the source of truth. It reuses the build's
own <path> definition (including its include/exclude rules) to emit a .classpath whose
library entries are project-relative, so the language server resolves the exact same classpath
that Ant compiles with.
- 🌳 Sidebar tree — discovers Ant build files in the workspace and lists their targets.
▶️ Run target — runs any target with Ant and streams output to an Output channel.- ⏹️ Stop target — a red status bar button appears while a target is running; click it to abort.
- 🔗 Jump to definition — click a target name to open the build file at the matching
<target>line. - ⭐ Default target highlight — the target named in
<project default="...">is marked with a star icon. - ✅ Active build file — when a folder holds more than one build file (e.g.
build.xmlandbuild-app.xml), mark one as active. Generation without an explicit target and auto-generate use the active file. - 📄 Generate .classpath (optional) — produces an Eclipse
.classpathfrom a build file's<path>(default idclasspath), creates a minimal.projectalongside it if one does not already exist, and reloads the Java project configuration. - 🔄 Auto-generate (optional) — optionally regenerates
.classpathwhen the build file changes.
- Apache Ant on your
PATH(or setantWorkbench.antPath). - For
.classpathgeneration only: the Language Support for Java extension.
Install it from the Visual Studio Code Marketplace.
https://marketplace.visualstudio.com/items?itemName=seiya-koji.ant-workbench
- Open the Ant Workbench view from the Activity Bar.
- If a folder has multiple build files, click Set as Active on the one you use.
- The active file is marked in the tree.
- Expand a build file to see its targets.
- The default target is marked with a star icon.
- Click a target name to jump to its definition in the build file.
- Click the inline Run button on a target to execute it.
- A red Stop Ant button appears in the status bar while it runs.
- (Optional) Use the inline Generate .classpath action on a build file to update Java language server resolution.
| Setting | Default | Description |
|---|---|---|
antWorkbench.antPath |
ant |
Path to the Ant executable. |
antWorkbench.outputEncoding |
auto |
Encoding of Ant output. auto detects the Windows code page. |
antWorkbench.buildFileGlob |
**/build*.xml |
Glob used to discover build files (non-<project> are ignored). |
antWorkbench.exclude |
[] |
Globs excluded from discovery. Empty honors files.exclude. |
antWorkbench.classpathPathId |
classpath |
Id of the <path> reused to generate .classpath. |
antWorkbench.autoGenerate |
false |
Regenerate .classpath when the build file changes. |
antWorkbench.additionalClasspaths |
[] |
Additional .classpath targets. Add via sidebar or edit manually. |
The last three settings only apply when using the .classpath generation feature.
If multi-byte characters look garbled in the OUTPUT window, check antWorkbench.outputEncoding:
the default auto matches the encoding Java actually uses for piped output (the system code page
on Windows, UTF-8 elsewhere). Set an explicit value such as utf-8 when your build forces a
different one (e.g. via ANT_OPTS).
If a build file configures multiple Eclipse projects — for example a source project and a
companion test project — you can generate a .classpath for each.
Use the Add Classpath Target inline button in the sidebar:
- Click the $(add) Add Classpath Target icon on the build file row.
- Pick the Ant
<path>id from the QuickPick.- Paths other than the primary are listed automatically.
- Select the output directory from the workspace directory list.
- Optionally pick one or more sibling projects to reference as source (
projectDeps); press Esc to skip. - The entry is saved to
antWorkbench.additionalClasspathsin.vscode/settings.json.
The next Generate .classpath run also generates the additional file.
You can also edit the setting directly:
"antWorkbench.additionalClasspaths": [
{
"pathId": "test-classpath",
"outputDir": "MyProject-test",
"projectDeps": ["MyProject"]
}
]| Field | Required | Description |
|---|---|---|
pathId |
yes | Id of the Ant <path> whose entries become library entries. |
outputDir |
yes | Where to write .classpath, relative to the workspace folder. |
projectDeps |
no | Eclipse project names added as <classpathentry kind="src"> references. |
Note
The added project must be at the same directory depth as the primary project (sibling) for the generated relative paths to resolve correctly.
This feature is useful when using the Java language server alongside Ant.
- A small generator script is placed next to the selected build file, imports it, and converts
the build's
<path>to project-relative<classpathentry>lib entries. Because the generator runs from the build file's directory, the build's own basedir-relative properties resolve correctly. - Alongside
.classpath, a minimal.project(withjavanatureandjavabuilder) is written in the same directory if one does not already exist. Eclipse JDT LS treats a folder as a Java project only when.projectis present; a.classpathon its own is silently ignored. - An existing
.projectis left untouched so any content managed by the language server (e.g.filteredResources) is preserved.
Both generated files are normal Eclipse project files; consider adding them to .gitignore since
they are produced locally per machine.