// Create the project jar file.
File projectJarFile = new File(zipDir, eclipseProject.getName()
+ ".jar");
// Update the manifest.
// If there is already a manifest file, load it.
Manifest manifest = null;
File manifestFile = new File(projectJarDir,
"META-INF/MANIFEST.MF");
if (manifestFile.exists()) {
manifest = loadManifest(manifestFile);
} else {
manifest = CreateJarUtils.createDefaultManifest();
}
progress.increment(1, "Creating manifest files");
if (manifest.getMainSection().getAttribute("Main-Class") != null) {
manifest.getMainSection().removeAttribute("Main-Class");
}
manifest.getMainSection().addConfiguredAttribute(
new Manifest.Attribute("Main-Class", mainClass));
FileUtils.mkdirs(manifestFile.getParentFile());
saveManifest(manifestFile, manifest);
// Create the jar.