/**
* Create a manifest
*/
private void createManifest(final java.util.jar.Manifest manifest) throws MojoExecutionException {
// create a new manifest
final Manifest outManifest = new Manifest();
try {
boolean hasMain = false;
// copy entries from existing manifest
if ( manifest != null ) {
final Map<Object, Object> attrs = manifest.getMainAttributes();
for(final Map.Entry<Object, Object> entry : attrs.entrySet()) {
final String key = entry.getKey().toString();
if ( !BuildConstants.ATTRS_EXCLUDES.contains(key)) {
final Attribute a = new Attribute(key, entry.getValue().toString());
outManifest.addConfiguredAttribute(a);
}
if ( key.equals(BuildConstants.ATTR_MAIN_CLASS) ) {
hasMain = true;
}
}
}
outManifest.addConfiguredAttribute(new Attribute(BuildConstants.ATTR_IMPLEMENTATION_BUILD,
project.getVersion()));
outManifest.addConfiguredAttribute(new Attribute(BuildConstants.ATTR_IMPLEMENTATION_VERSION,
project.getVersion()));
String organizationName = project.getOrganization() != null ? project.getOrganization().getName() : null;
if ( organizationName != null ) {
outManifest.addConfiguredAttribute(new Attribute(BuildConstants.ATTR_IMPLEMENTATION_VENDOR,
organizationName));
outManifest.addConfiguredAttribute(new Attribute(BuildConstants.ATTR_CREATED_BY,
organizationName));
outManifest.addConfiguredAttribute(new Attribute(BuildConstants.ATTR_BUILT_BY,
organizationName));
outManifest.addConfiguredAttribute(new Attribute(BuildConstants.ATTR_SPECIFICATION_VENDOR,
organizationName));
}
outManifest.addConfiguredAttribute(new Attribute(BuildConstants.ATTR_IMPLEMENTATION_VENDOR_ID,
project.getGroupId()));
outManifest.addConfiguredAttribute(new Attribute(BuildConstants.ATTR_IMPLEMENTATION_TITLE,
project.getName()));
outManifest.addConfiguredAttribute(new Attribute(BuildConstants.ATTR_SPECIFICATION_TITLE,
project.getName()));
outManifest.addConfiguredAttribute(new Attribute(BuildConstants.ATTR_SPECIFICATION_VERSION,
project.getVersion()));
if ( archiver.getDestFile().getName().endsWith(".jar") && !hasMain) {
outManifest.addConfiguredAttribute(new Attribute(BuildConstants.ATTR_MAIN_CLASS,
BuildConstants.ATTR_VALUE_MAIN_CLASS));
}
archiver.addConfiguredManifest(outManifest);
} catch (final ManifestException e) {