Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-ant-dev] Problem with AntRunner...

Hi,

I'd like to execute an Ant script programmatically from a plugin I am
writing. I have followed the online documentation and here is my code
snippet:

		AntRunner runner = new AntRunner();
		runner.setBuildFileLocation(
			"path/to/build.xml");
		runner.setArguments("-Dmessage=Building -verbose");
		try {
			runner.run();
		}
		catch (Exception e) {
			e.printStackTrace();
		}

When I run it I get a NPE. Debugging shows that the NPE comes from the
following line in AntRunner:

ClassLoader loader = AntCorePlugin.getPlugin().getClassLoader();

The problem is that AntCorePlugin.getPlugin() returns null, which seems
to mean that the AntCorePlugin was not initialized in the workbench. 

I can see an "Ant Build Tool Core" in the list of loaded plugins? Is
that this one? One many Ant plugins are there? Does it have to do with
the fact that Ant was moved to be an external tool? If so, does it mean
the AntCorePlugin is now deprecated? If so, how can I now call an Ant
script programatically?

Thanks a lot!
-Vincent





Back to the top