ProjectHelper2 projectHelper = new ProjectHelper2();
try {
// Use the 3-param version of parse(), rather than the 2-param version, or ProjectHelper.configureProject(),
// to avoid actually executing the implicit target (which would cause the rhq:bundle task to be executed).
AntXMLContext context = (AntXMLContext) project.getReference(REFID_CONTEXT);
projectHelper.parse(project, buildFile, new ProjectHelper2.RootHandler(context,
new ProjectHelper2.MainHandler()));
} catch (BuildException e) {
throw new InvalidBuildFileException("Failed to parse bundle Ant build file.", e);
}