Manifest (Gradle API 2.14.1)

Package: org.gradle.api.java.archives

## [Java] Interface Manifest

- Represents the manifest file of a JAR file.

- - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `Manifest` | `attributes(Map<String, ?> attributes)` Adds content to the main attributes of the manifest.
    `Manifest` | `attributes(Map<String, ?> attributes, String sectionName)` Adds content to the given section of the manifest.
    `Manifest` | `from(Object... mergePath)` Specifies other manifests to be merged into this manifest.
    `Manifest` | `from(Object mergePath, groovy.lang.Closure<?> closure)` Specifies other manifests to be merged into this manifest.
    `Attributes` | `getAttributes()` Returns the main attributes of the manifest.
    `Manifest` | `getEffectiveManifest()` Returns a new manifest instance where all the attribute values are expanded (e.g. their toString method is called).
    `Map<String, Attributes>` | `getSections()` Returns the sections of the manifest (excluding the main section).
    `Manifest` | `writeTo(Writer writer)` Writes the manifest into a writer.
    `Manifest` | `writeTo(Object path)` Writes the manifest into a file.

- - ### Method Detail

    - #### public Manifest attributes(Map<String, ?> attributes)

      Adds content to the main attributes of the manifest.

      throws:
        ManifestException If a key is invalid according to the manifest spec or if a key or value is null.
      Parameters:
        `attributes` - The values to add to the main attributes. The values can be any object. For evaluating the value objects their Object.toString method is used. This is done lazily either before writing or when getEffectiveManifest() is called.
      Returns:
        this

    - #### public Manifest attributes(Map<String, ?> attributes, String sectionName)

      Adds content to the given section of the manifest.

      throws:
        ManifestException If a key is invalid according to the manifest spec or if a key or value is null.
      Parameters:
        `attributes` - The values to add to the section. The values can be any object. For evaluating the value objects their Object.toString method is used. This is done lazily either before writing or when getEffectiveManifest() is called.
        `sectionName` - The name of the section
      Returns:
        this

    - #### public Manifest from(Object... mergePath)

      Specifies other manifests to be merged into this manifest. A merge path can either be another instance of Manifest or a file path as interpreted by Project.files. The merge is not happening instantaneously. It happens either before writing or when getEffectiveManifest() is called.

      Parameters:
        mergePath
      Returns:
        this

    - #### public Manifest from(Object mergePath, groovy.lang.Closure<?> closure)

      Specifies other manifests to be merged into this manifest. A merge path is interpreted as described in from(Object...). The merge is not happening instantaneously. It happens either before writing or when getEffectiveManifest() is called. The closure configures the underlying ManifestMergeSpec.

      Parameters:
        mergePath
        closure
      Returns:
        this

    - #### public Attributes getAttributes()

      Returns the main attributes of the manifest.

    - #### public Manifest getEffectiveManifest()

      Returns a new manifest instance where all the attribute values are expanded (e.g. their toString method is called). The returned manifest also contains all the attributes of the to be merged manifests specified in from(Object...).

    - #### public Map<String, Attributes> getSections()

      Returns the sections of the manifest (excluding the main section).

      Returns:
        A map with the sections, where the key represents the section name and value the section attributes.

    - #### @Deprecated public Manifest writeTo(Writer writer)

      Writes the manifest into a writer. If writing to bytes, prefer using the UTF-8 character set for encoding. Note that using this method will break your Manifest if it contains long attribute names or values that may produce split multi-bytes characters. Prefer writeTo(Object) instead.

      Parameters:
        `writer` - The writer to write the manifest to
      Returns:
        this

    - #### public Manifest writeTo(Object path)

      Writes the manifest into a file. The path's are resolved as defined by Project.files The manifest will be encoded using the character set defined by the Jar.getManifestContentCharset property.

      Parameters:
        `path` - The path of the file to write the manifest into.
      Returns:
        this