private IStatus generateFolder(String folderPath) { MultiStatus status = new MultiStatus(Plugin.PLUGIN_ID, 0, "Errors occurred during exporting.", null); File folder = new File(folderPath); File bundleFolder = new File(folder, "bundles"); bundleFolder.mkdirs(); if (!bundleFolder.exists()) { status.add(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Unable to create folder.", null)); return status; } ProjectLauncher launcher = null; try { launcher = bndProject.getProjectLauncher(); } catch (Exception e) { status.add( new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error getting project launcher.", e)); } // Init classpath and launch JAR generateLauncherJar(launcher, folder, status); copyRunBundles(launcher, folder, status); return status; }
private IStatus generateJar(String jarPath) { MultiStatus status = new MultiStatus(Plugin.PLUGIN_ID, 0, "Errors occurred during exporting.", null); ProjectLauncher launcher = null; try { launcher = bndProject.getProjectLauncher(); } catch (Exception e) { status.add( new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error getting project launcher.", e)); } try { Jar jar = launcher.executable(); jar.write(jarPath); } catch (Exception e) { status.add( new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error generating executable JAR.", e)); } return status; }