Preserve the original META-INF data of each bundled jar. Only inlucde "jar" artifacts

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@419267 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-07-05 16:05:04 +00:00
parent 104305bac0
commit 5b26cd83c9
1 changed files with 23 additions and 4 deletions

View File

@ -66,7 +66,7 @@ public class BundleMojo extends AbstractMojo
{ {
Artifact a = (Artifact) itr.next(); Artifact a = (Artifact) itr.next();
if (includeList.contains(a.getArtifactId())) if (includeList.contains(a.getArtifactId()) && "jar".equals(a.getType()) )
{ {
getLog().info("Found " + a.getArtifactId()); getLog().info("Found " + a.getArtifactId());
@ -93,13 +93,32 @@ public class BundleMojo extends AbstractMojo
try try
{ {
getLog().info("Extracting: "+file+": to "+location);
UnArchiver unArchiver = this.archiverManager.getUnArchiver( archiveExt ); UnArchiver unArchiver = this.archiverManager.getUnArchiver( archiveExt );
unArchiver.setSourceFile( file ); unArchiver.setSourceFile( file );
unArchiver.setDestDirectory( location ); unArchiver.setDestDirectory( location );
unArchiver.extract(); unArchiver.extract();
File metaDir = new File(location, "META-INF");
File jarMetaDir = new File(metaDir, file.getName());
FileUtils.mkdir(jarMetaDir.getAbsolutePath());
File[] files = metaDir.listFiles();
for (int i = 0; i < files.length; i++) {
String name = files[i].getName();
if(
name.toUpperCase().startsWith("MANIFEST.MF") ||
name.toUpperCase().startsWith("COPYRIGHT") ||
name.toUpperCase().startsWith("LICENSE") ||
name.toUpperCase().startsWith("NOTICE") ||
name.toUpperCase().startsWith("DISCLAIMER")
) {
FileUtils.copyFileToDirectory(files[i], jarMetaDir);
files[i].delete();
}
}
} }
catch ( IOException e ) catch ( IOException e )
{ {