Ant WorkbenchBrowse Ant build files from a dedicated sidebar and run their targets directly from VS Code.
For Java projects, it can also generate Eclipse OverviewAnt 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. When
|
| 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).
Generating .classpath for additional projects
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.
How .classpath generation works (optional)
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.