Errors In Programmatically Running ANT Build In Eclipse
- by Sujay
I am trying to run an ANT script through a small Java program and I keep on encountering the following error:
build:
Exception in thread "main" build.xml:7: Problem: failed to create task or type eclipse.refreshLocal
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
at org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownElement.java:487)
at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:419)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
I used to get this problem when I used to execute the build file manually. All I had to do to make Eclipse run this build was to go to Run External Tools External Tools Configuration JRE and select "Run in the same JRE as the workspace" and then attempt to execute.
But I have no idea how to achieve the same effect through my code. Any suggestion would really be appreciated.
Note that this has reference to a previous question that I asked over here