in src/main/java/org/apache/maven/archiver/MavenArchiver.java [137:184]
public Manifest getManifest(MavenSession session, MavenProject project, MavenArchiveConfiguration config)
throws ManifestException, DependencyResolutionRequiredException {
boolean hasManifestEntries = !config.isManifestEntriesEmpty();
Map<String, String> entries = hasManifestEntries ? config.getManifestEntries() : Collections.emptyMap();
Manifest manifest = getManifest(session, project, config.getManifest(), entries);
// any custom manifest entries in the archive configuration manifest?
if (hasManifestEntries) {
for (Map.Entry<String, String> entry : entries.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
Manifest.Attribute attr = manifest.getMainSection().getAttribute(key);
if (key.equals(Attributes.Name.CLASS_PATH.toString()) && attr != null) {
// Merge the user-supplied Class-Path value with the programmatically
// created Class-Path. Note that the user-supplied value goes first
// so that resources there will override any in the standard Class-Path.
attr.setValue(value + " " + attr.getValue());
} else {
addManifestAttribute(manifest, key, value);
}
}
}
// any custom manifest sections in the archive configuration manifest?
if (!config.isManifestSectionsEmpty()) {
for (ManifestSection section : config.getManifestSections()) {
Manifest.Section theSection = new Manifest.Section();
theSection.setName(section.getName());
if (!section.isManifestEntriesEmpty()) {
Map<String, String> sectionEntries = section.getManifestEntries();
for (Map.Entry<String, String> entry : sectionEntries.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
Manifest.Attribute attr = new Manifest.Attribute(key, value);
theSection.addConfiguredAttribute(attr);
}
}
manifest.addConfiguredSection(theSection);
}
}
return manifest;
}