Class Jar

All Implemented Interfaces:
Comparable<Task>, ContentFilterable, CopyProcessingSpec, CopySourceSpec, CopySpec, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.file.copy.CopySpecSource, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, ExtensionAware, Task, PatternFilterable, org.gradle.util.Configurable<Task>
Direct Known Subclasses:
Jar

@Incubating public class Jar extends Zip
Assembles a JAR archive.
  • Field Details

  • Constructor Details

    • Jar

      public Jar()
  • Method Details

    • getMetadataCharset

      public String getMetadataCharset()
      The character set used to encode JAR metadata like file names. Defaults to UTF-8. You can change this property but it is not recommended as JVMs expect JAR metadata to be encoded using UTF-8
      Overrides:
      getMetadataCharset in class Zip
      Returns:
      the character set used to encode JAR metadata like file names
      Since:
      2.14
    • setMetadataCharset

      public void setMetadataCharset(String metadataCharset)
      The character set used to encode JAR metadata like file names. Defaults to UTF-8. You can change this property but it is not recommended as JVMs expect JAR metadata to be encoded using UTF-8
      Overrides:
      setMetadataCharset in class Zip
      Parameters:
      metadataCharset - the character set used to encode JAR metadata like file names
      Since:
      2.14
    • getManifestContentCharset

      @Input @Incubating public String getManifestContentCharset()
      The character set used to encode the manifest content. Defaults to UTF-8. You can change this property but it is not recommended as JVMs expect manifests content to be encoded using UTF-8.
      Returns:
      the character set used to encode the manifest content
      Since:
      2.14
    • setManifestContentCharset

      @Incubating public void setManifestContentCharset(String manifestContentCharset)
      The character set used to encode the manifest content.
      Parameters:
      manifestContentCharset - the character set used to encode the manifest content
      Since:
      2.14
      See Also:
    • getManifest

      @Internal public Manifest getManifest()
      Returns the manifest for this JAR archive.
      Returns:
      The manifest
    • setManifest

      public void setManifest(Manifest manifest)
      Sets the manifest for this JAR archive.
      Parameters:
      manifest - The manifest. May be null.
    • manifest

      public Jar manifest(Closure<?> configureClosure)
      Configures the manifest for this JAR archive.

      The given closure is executed to configure the manifest. The Manifest is passed to the closure as its delegate.

      Parameters:
      configureClosure - The closure.
      Returns:
      This.
    • manifest

      public Jar manifest(Action<? super Manifest> configureAction)
      Configures the manifest for this JAR archive.

      The given action is executed to configure the manifest.

      Parameters:
      configureAction - The action.
      Returns:
      This.
      Since:
      3.5
    • getMetaInf

      @Internal public CopySpec getMetaInf()
    • metaInf

      public CopySpec metaInf(Closure<?> configureClosure)
      Adds content to this JAR archive's META-INF directory.

      The given closure is executed to configure a CopySpec. The CopySpec is passed to the closure as its delegate.

      Parameters:
      configureClosure - The closure.
      Returns:
      The created CopySpec
    • metaInf

      public CopySpec metaInf(Action<? super CopySpec> configureAction)
      Adds content to this JAR archive's META-INF directory.

      The given action is executed to configure a CopySpec.

      Parameters:
      configureAction - The action.
      Returns:
      The created CopySpec
      Since:
      3.5