public static Manifest getDefaultManifest ( ) throws ArchiverException { try { String defManifest = "/org/codehaus/plexus/archiver/jar/defaultManifest.mf" ; InputStream in = Manifest . class . getResourceAsStream ( defManifest ) ; if ( in == null ) { throw new ArchiverException ( "Could not find default manifest: " + defManifest ) ; } try { Manifest defaultManifest = new Manifest ( new InputStreamReader ( in , "UTF-8" ) ) ; defaultManifest . getMainAttributes ( ) . putValue ( "Created-By" , System . getProperty ( "java.vm.version" ) + " (" + System . getProperty ( "java.vm.vendor" ) + ")" ) ; return defaultManifest ; } catch ( UnsupportedEncodingException e ) { return new Manifest ( new InputStreamReader ( in ) ) ; } finally { IOUtil . close ( in ) ; } } catch ( ManifestException e ) { throw new ArchiverException ( "Default manifest is invalid !!" , e ) ; } catch ( IOException e ) { throw new ArchiverException ( "Unable to read default manifest" , e ) ; } }
Construct a manifest from Ant s default manifest file .