Source:
protected void appendMetadataToArchive(String[] configuration, IProgressMonitor monitor) { String filename = fInfo.zipFileName; if (configuration != null) { int i = filename.lastIndexOf('.'); filename = filename.substring(0, i) + '.' + configuration[0] + '.' + configuration[1] + '.' + configuration[2] + filename.substring(i); } String archive = fInfo.destinationDirectory + File.separator + filename; File scriptFile = null; try { scriptFile = createScriptFile("append.xml"); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); Document doc = factory.newDocumentBuilder().newDocument(); Element root = doc.createElement("project"); root.setAttribute("name", "temp"); root.setAttribute("default", "append"); root.setAttribute("basedir", "."); doc.appendChild(root); Element target = doc.createElement("target"); target.setAttribute("name", "clean"); Element child = doc.createElement("delete"); child.setAttribute("dir", fBuildTempMetadataLocation); target.appendChild(child); root.appendChild(target); target = doc.createElement("target"); target.setAttribute("name", "append"); child = doc.createElement("zip"); child.setAttribute("zipfile", archive); child.setAttribute("basedir", fBuildTempMetadataLocation); child.setAttribute("update", "true"); target.appendChild(child); root.appendChild(target); XMLPrintHandler.writeFile(doc, scriptFile); String[] targets = new String[] {"append", "clean"}; AntRunner runner = new AntRunner(); runner.setBuildFileLocation(scriptFile.getAbsolutePath()); runner.setExecutionTargets(targets); runner.run(SubMonitor.convert(monitor, 1).newChild(1)); } catch (FactoryConfigurationError e) { } catch (ParserConfigurationException e) { } catch (CoreException e) { } catch (IOException e) { } finally { if (scriptFile != null && scriptFile.exists()) scriptFile.delete(); monitor.done(); } }

Target:
protected void appendMetadataToArchive(String[] configuration, IProgressMonitor monitor) { String filename = fInfo.zipFileName; if (configuration != null) { int i = filename.lastIndexOf('.'); filename = filename.substring(0, i) + '.' + configuration[0] + '.' + configuration[1] + '.' + configuration[2] + filename.substring(i); } String archive = fInfo.destinationDirectory + File.separator + filename; File scriptFile = null; SubMonitor subMonitor = SubMonitor.convert(monitor, 1); try { scriptFile = createScriptFile("append.xml"); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); Document doc = factory.newDocumentBuilder().newDocument(); Element root = doc.createElement("project"); root.setAttribute("name", "temp"); root.setAttribute("default", "append"); root.setAttribute("basedir", "."); doc.appendChild(root); Element target = doc.createElement("target"); target.setAttribute("name", "clean"); Element child = doc.createElement("delete"); child.setAttribute("dir", fBuildTempMetadataLocation); target.appendChild(child); root.appendChild(target); target = doc.createElement("target"); target.setAttribute("name", "append"); child = doc.createElement("zip"); child.setAttribute("zipfile", archive); child.setAttribute("basedir", fBuildTempMetadataLocation); child.setAttribute("update", "true"); target.appendChild(child); root.appendChild(target); XMLPrintHandler.writeFile(doc, scriptFile); String[] targets = new String[] {"append", "clean"}; AntRunner runner = new AntRunner(); runner.setBuildFileLocation(scriptFile.getAbsolutePath()); runner.setExecutionTargets(targets); runner.run(subMonitor.newChild(1)); } catch (FactoryConfigurationError e) { } catch (ParserConfigurationException e) { } catch (CoreException e) { } catch (IOException e) { } finally { if (scriptFile != null && scriptFile.exists()) { scriptFile.delete(); } } }