/** @see org.apache.tools.ant.Task#execute() */ @Override public void execute() throws BuildException { if (dumpFile == null) throw new BuildException("File to dump to is missing"); ModelFactory fact = new ModelFactory(loader); try { ClassModel model = fact.modelForName(className); FileWriter writer = new FileWriter(dumpFile); IndentingPrintWriter ipw = new IndentingPrintWriter(writer); model.dump(ipw); ipw.flush(); writer.close(); } catch (Exception ex) { ex.printStackTrace(); throw new BuildException(ex); } }