Is there a way to programatically start eclipse export function

geibi :

I'm working on an Eclipse plugin, and at a certain point I want to export a Java Project to a .jar-file. Eclipse does offer a functionality to do this (by right-click on project -> Export), but I don't know how to call it out of code.

Can someone help me out?

geibi :

Update: I found an working solution

FeatureExportInfo info = new FeatureExportInfo();
info.useJarFormat = true;
info.items = bundlesToExport.toArray(); //bundlesToExport is a ArrayList<IModel>
PluginExportOperation exportJob = new PluginExportOperation(info, "Export selected bundles");
exportJob.setUser(true);
exportJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
exportJob.schedule();

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=162519&siteId=1