Hi,
I am working on my first Eclipse Plug-in Project.
Objective: I am trying to
execute a target of ANT build file from Created Menu Item Action using Eclipse Plug-in
Project.
Approach: Inside the method using
AntRunner Class I am trying to call the external build file to run the default
target.
public
void run(IAction
action) {
Bundle bundle = Platform.getBundle("com.test.eclipse.plugins.testbuild");
Path path = new Path("/resource/test-build.xml");
URL buildFileURL = Platform.find(bundle,
path);
AntRunner runner = null;
if(buildFileURL != null) {
runner = new AntRunner();
try {
runner.setBuildFileLocation(Platform.asLocalURL(buildFileURL).toExternalForm());
}
catch (IOException e) {
e.printStackTrace();
}
runner.setArguments("-Dmessage=Building
-verbose");
runner.addBuildLogger(ANT_LOGGER_CLASS);
}
try {
runner.run();
}
catch (CoreException e) {
e.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
Exception: I am
getting the following exception
org.eclipse.core.runtime.CoreException: BUILD FAILED
at org.eclipse.ant.core.AntRunner.run(AntRunner.java:387)
at org.eclipse.ant.core.AntRunner.run(AntRunner.java:474)
Verified: The above program
locates the build file properly but when it tries to execute it throws the CoreException.
Note: The test build file I tried works
fine independently.
Any thoughts/help would be greatly appreciated.
Thanks
-- jpv