ExportCodeSpec exportSpec = new ExportCodeSpec();
exportSpec.setPackages(packages);
exportSpec.includeJava(exportSources);
exportSpec.includeClass(exportClasses);
exportSpec.includeResources(exportResources);
exportSpec.includeClassDebugInfo(exportDebugInfo);
exportSpec.useSubdirectories(true);
exportSpec.overwriteFiles(overwrite);
exportSpec.setExportDirectory(dest.getAbsolutePath());
getWorkspace().exportData(exportSpec);