Summary: | Ant can't run within another Java program | ||
---|---|---|---|
Product: | Ant | Reporter: | David Byrden <bugzilla> |
Component: | Core | Assignee: | Ant Notifications List <notifications> |
Status: | NEEDINFO --- | ||
Severity: | enhancement | ||
Priority: | P2 | ||
Version: | 1.7.1 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows XP |
Description
David Byrden
2009-09-16 14:46:02 UTC
i just saw this post noting "the Launcher class makes 2 ClassLoaders and assumes they will connect up in a parent-child relationship. For me, they don't. I can see no reason why Launcher should not make that connection explicitly." i came upon this issue when another Java apache project produced classloader error "org.apache.tools.ant.Main cannot be cast to org.apache.tools.ant.launch.AntMain" (attempting to pass its own CL to Ant and failed) can we vote to accept davids mods as a workaround to this issue? thanks Martin Launcher only calls System.exit() in case something went wrong (non-zero exit status) Main also calls System.exit for a 0 exit status in case nothing went wrong (This may not be necessary, will investigate). Launcher is strictly meant to be used from the command line. Does it make sense to modify Launcher to solve [2] without fully solving [1], please note the System.exit calls are needed in Launcher and Main to indicate to the shell that something went wrong. Like Martijn said, Ant's Main has a very good reason to call System.exit, namely to have control over the process' exit code which is vital to many shell-script/batch-file scenarios. The System.exit in Launcher will only ever be triggered if the AntMain implementation throws an exception. Since you need to plug in your own AntMain implementation anyway, this should be easy to avoid. For [2]: what does you modified implementation look like and would you be willing to contribute it? |