[ http://jira.codehaus.org/browse/MNG-742?page=all ] Brett Porter closed MNG-742: ----------------------------
Assign To: Brett Porter Resolution: Fixed applied. Please use patches and the Maven formatting in future. > Added functionality to maven-archiver so plug-ins can add custom entries to > the archiver's manifest > --------------------------------------------------------------------------------------------------- > > Key: MNG-742 > URL: http://jira.codehaus.org/browse/MNG-742 > Project: Maven 2 > Type: Improvement > Components: maven-archiver > Versions: 2.0-alpha-3 > Reporter: Timothy Bennett > Assignee: Brett Porter > Priority: Critical > Fix For: 2.0-beta-1 > Attachments: MavenArchiveConfiguration.java, MavenArchiver.java > > > Added functionality to the maven-archiver plugin so that other plugins can > add custom manifest entries. Made some fairly minor changes to both > MavenArchiveConfiguration.java and MavenArchiver.java. Description of > changes below, and I've attached my marked up changes to the M2 HEAD of both > files. > MavenArchiveConfiguration.java > ========================= > Added the following methods (along with appropriate imports): > private Map manifestEntries = new HashMap(); > public void addManifestEntry(Object key, Object value) { > manifestEntries.put(key, value); > } > public void addManifestEntries(Map map) { > manifestEntries.putAll(map); > } > public boolean isManifestEntriesEmpty() { > return manifestEntries.isEmpty(); > } > public Map getManifestEntries() { > return manifestEntries; > } > Changes maintain a collection of custom manifest entries stored a name-value > pairs. Plugins use the first two methods to add custom manifest entries to > the collection. MavenArchiver uses the last two methods to retrieve the set > of entries and add them to the archive's manifest. > =============== > MavenArchiver.java > =============== > In the createArchive() method of MavenArchiver, added the following marked > code block to retrieve the custom manifest entries (if any available) from > the MavenArchiveConfiguration and add them to the archive's manifest. > Manifest manifest = getManifest( project, > archiveConfiguration.getManifest() ); > // THIS IS THE START OF THE CODE BLOCK I ADDED > // any custom manifest entries in the archive configuration > manifest? > if (!archiveConfiguration.isManifestEntriesEmpty()) { > Map entries = archiveConfiguration.getManifestEntries(); > Set keys = entries.keySet(); > for (Iterator iter = keys.iterator(); iter.hasNext(); ) > { > String key = (String) iter.next(); > String value = (String) entries.get(key); > Manifest.Attribute attr = new > Manifest.Attribute(key, value); > manifest.addConfiguredAttribute(attr); > } > } > // THIS IS THE END OF THE CODE BLOCK I ADDED > // Configure the jar > archiver.addConfiguredManifest( manifest ); -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]