code: private Manifest createManifest( File jar, Map<String, String> manifestentries )
              throws MojoExecutionException
      {
          JarFile jarFile = null;
          try
          {
              jarFile = new JarFile( jar );
  
              // read manifest from jar
              Manifest manifest = jarFile.getManifest();
  
              if ( manifest == null || manifest.getMainAttributes().isEmpty() )
              {
                  manifest = new Manifest();
                  manifest.getMainAttributes().putValue( Attributes.Name.MANIFEST_VERSION.toString(), "1.0" );
              }
  
              // add or overwrite entries
              Set<Map.Entry<String, String>> entrySet = manifestentries.entrySet();
              for ( Map.Entry<String, String> entry : entrySet )
              {
                  manifest.getMainAttributes().putValue( entry.getKey(), entry.getValue() );
              }
  
              return manifest;
          }
          catch ( IOException e )
          {
              throw new MojoExecutionException( "Error while reading manifest from " + jar.getAbsolutePath(), e );
          }
          finally
          {
              ioUtil.close( jarFile );
          }
      }
docs: Create the new manifest from the existing jar file and the new entries.
  
  @param jar
  @param manifestentries
  @return Manifest
  @throws MojoExecutionException