Bug 60312 - Create, or document how to embed Ant in Java
Summary: Create, or document how to embed Ant in Java
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Depends on:
Reported: 2016-10-27 10:21 UTC by Jochen Wiedmann
Modified: 2018-08-31 18:41 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Jochen Wiedmann 2016-10-27 10:21:41 UTC
It is no unusual requirement, to invoke an Ant script from within a Java class. This procedure is, what I would describe as ("Embed Ant in Java").

To support such a use case, there shuld be an EmbeddedAnt bean, or something similar, with methods like getBuildFile(), setBuildFile(File pFile), and the like, which does just that. However, AFAIK, there is no such thing.

In the "Running Apache Ant" document (https://ant.apache.org/manual/running.html), there's a section "Running Ant via Java". However, that advice is close to unusable. It suggests either of the classes Main, or Launcher. Neither of these is suited for embedding, because they both invoke System.exit(), which is clearly not allowed in an embedded solution.

This request is to create a solution for embedding Ant. Or, if such a solution exists, have it documented.


Comment 1 Gintas Grigelionis 2018-08-31 18:41:49 UTC
Would it be sufficient, as in Ivy, to provide a public run() in Launcher?