Jar (Gradle API 2.14.1)

Package: org.gradle.jvm.tasks

## [Java] Class Jar

- org.gradle.jvm.tasks.Jar

- Assembles a JAR archive.

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static String` | `DEFAULT_EXTENSION` |

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class Zip` | `ZIP_EXTENSION`
    `class org.gradle.api.internal.ConventionTask` | `TASK_NAME, TASK_DESCRIPTION, TASK_GROUP, TASK_TYPE, TASK_DEPENDS_ON, TASK_OVERWRITE, TASK_ACTION`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `Jar ()`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `Manifest` | `getManifest()` Returns the manifest for this JAR archive.
    `String` | `getManifestContentCharset()` The character set used to encode the manifest content.
    `CopySpec` | `getMetaInf()`
    `String` | `getMetadataCharset()` The character set used to encode JAR metadata like file names.
    `Jar` | `manifest(groovy.lang.Closure<?> configureClosure)` Configures the manifest for this JAR archive.
    `CopySpec` | `metaInf(groovy.lang.Closure<?> configureClosure)` Adds content to this JAR archive's META-INF directory.
    `void` | `setManifest(Manifest manifest)` Sets the manifest for this JAR archive.
    `void` | `setManifestContentCharset(String manifestContentCharset)` The character set used to encode the manifest content.
    `void` | `setMetadataCharset(String metadataCharset)` The character set used to encode JAR metadata like file names.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Zip` | `createCopyAction, getCompressor, getEncoding, getEntryCompression, getMetadataCharset, isZip64, setEncoding, setEntryCompression, setMetadataCharset, setZip64`
    `class AbstractArchiveTask` | `getAppendix, getArchiveName, getArchivePath, getBaseName, getClassifier, getDestinationDir, getExtension, getVersion, into, into, setAppendix, setArchiveName, setBaseName, setClassifier, setDestinationDir, setExtension, setVersion`
    `class AbstractCopyTask` | `copy, createCopyAction, createRootSpec, eachFile, eachFile, exclude, exclude, exclude, exclude, expand, filesMatching, filesNotMatching, filter, filter, filter, from, from, getDirMode, getDuplicatesStrategy, getExcludes, getFileLookup, getFileMode, getFileResolver, getFileSystem, getFilteringCharset, getIncludeEmptyDirs, getIncludes, getInstantiator, getMainSpec, getRootSpec, getSource, include, include, include, include, into, into, isCaseSensitive, rename, rename, rename, setCaseSensitive, setDirMode, setDuplicatesStrategy, setExcludes, setFileMode, setFilteringCharset, setIncludeEmptyDirs, setIncludes, with`
    `class org.gradle.api.internal.ConventionTask` | `org.gradle.api.internal.ConventionTask#conventionMapping(java.lang.String, groovy.lang.Closure), org.gradle.api.internal.ConventionTask#conventionMapping(java.lang.String, java.util.concurrent.Callable), org.gradle.api.internal.ConventionTask#getConventionMapping(), org.gradle.api.internal.ConventionTask#setProperty(java.lang.String, java.lang.Object), org.gradle.api.internal.ConventionTask#toString(), org.gradle.api.internal.ConventionTask#compareTo(org.gradle.api.Task), org.gradle.api.internal.ConventionTask#compareTo(java.lang.Object), org.gradle.api.internal.ConventionTask#getName(), org.gradle.api.internal.ConventionTask#getActions(), org.gradle.api.internal.ConventionTask#setName(java.lang.String), org.gradle.api.internal.ConventionTask#getState(), org.gradle.api.internal.ConventionTask#getState(), org.gradle.api.internal.ConventionTask#getPath(), org.gradle.api.internal.ConventionTask#getExtensions(), org.gradle.api.internal.ConventionTask#getLogger(), org.gradle.api.internal.ConventionTask#execute(), org.gradle.api.internal.ConventionTask#configure(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#configure(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#getDescription(), org.gradle.api.internal.ConventionTask#leftShift(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#property(java.lang.String), org.gradle.api.internal.ConventionTask#isEnabled(), org.gradle.api.internal.ConventionTask#setEnabled(boolean), org.gradle.api.internal.ConventionTask#getOutputs(), org.gradle.api.internal.ConventionTask#getOutputs(), org.gradle.api.internal.ConventionTask#onlyIf(org.gradle.api.specs.Spec), org.gradle.api.internal.ConventionTask#onlyIf(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#setOnlyIf(org.gradle.api.specs.Spec), org.gradle.api.internal.ConventionTask#setOnlyIf(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#setDidWork(boolean), org.gradle.api.internal.ConventionTask#getDidWork(), org.gradle.api.internal.ConventionTask#doFirst(org.gradle.api.Action), org.gradle.api.internal.ConventionTask#doFirst(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#doLast(org.gradle.api.Action), org.gradle.api.internal.ConventionTask#doLast(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#deleteAllActions(), org.gradle.api.internal.ConventionTask#getEnabled(), org.gradle.api.internal.ConventionTask#getAnt(), org.gradle.api.internal.ConventionTask#getLogging(), org.gradle.api.internal.ConventionTask#getLogging(), org.gradle.api.internal.ConventionTask#hasProperty(java.lang.String), org.gradle.api.internal.ConventionTask#getConvention(), org.gradle.api.internal.ConventionTask#setDescription(java.lang.String), org.gradle.api.internal.ConventionTask#getGroup(), org.gradle.api.internal.ConventionTask#setGroup(java.lang.String), org.gradle.api.internal.ConventionTask#getTaskDependencies(), org.gradle.api.internal.ConventionTask#getTaskDependencies(), org.gradle.api.internal.ConventionTask#setDependsOn(java.lang.Iterable), org.gradle.api.internal.ConventionTask#dependsOn([Ljava.lang.Object;), org.gradle.api.internal.ConventionTask#getProject(), org.gradle.api.internal.ConventionTask#setActions(java.util.List), org.gradle.api.internal.ConventionTask#getDependsOn(), org.gradle.api.internal.ConventionTask#dependsOnTaskDidWork(), org.gradle.api.internal.ConventionTask#getInputs(), org.gradle.api.internal.ConventionTask#getTemporaryDir(), org.gradle.api.internal.ConventionTask#mustRunAfter([Ljava.lang.Object;), org.gradle.api.internal.ConventionTask#setMustRunAfter(java.lang.Iterable), org.gradle.api.internal.ConventionTask#getMustRunAfter(), org.gradle.api.internal.ConventionTask#finalizedBy([Ljava.lang.Object;), org.gradle.api.internal.ConventionTask#setFinalizedBy(java.lang.Iterable), org.gradle.api.internal.ConventionTask#getFinalizedBy(), org.gradle.api.internal.ConventionTask#shouldRunAfter([Ljava.lang.Object;), org.gradle.api.internal.ConventionTask#setShouldRunAfter(java.lang.Iterable), org.gradle.api.internal.ConventionTask#getShouldRunAfter(), org.gradle.api.internal.ConventionTask#getStandardOutputCapture(), org.gradle.api.internal.ConventionTask#getAsDynamicObject(), org.gradle.api.internal.ConventionTask#setProject(org.gradle.api.Project), org.gradle.api.internal.ConventionTask#injectIntoNewInstance(org.gradle.api.internal.project.ProjectInternal, java.lang.String, java.lang.Class, java.util.concurrent.Callable), org.gradle.api.internal.ConventionTask#prependParallelSafeAction(org.gradle.api.Action), org.gradle.api.internal.ConventionTask#getOnlyIf(), org.gradle.api.internal.ConventionTask#getImpliesSubProjects(), org.gradle.api.internal.ConventionTask#setImpliesSubProjects(boolean), org.gradle.api.internal.ConventionTask#getExecuter(), org.gradle.api.internal.ConventionTask#setExecuter(org.gradle.api.internal.tasks.TaskExecuter), org.gradle.api.internal.ConventionTask#getTemporaryDirFactory(), org.gradle.api.internal.ConventionTask#addValidator(org.gradle.api.internal.tasks.execution.TaskValidator), org.gradle.api.internal.ConventionTask#getValidators(), org.gradle.api.internal.ConventionTask#appendParallelSafeAction(org.gradle.api.Action), org.gradle.api.internal.ConventionTask#isHasCustomActions(), org.gradle.api.internal.ConventionTask#getTaskActions(), org.gradle.api.internal.ConventionTask#wait(long, int), org.gradle.api.internal.ConventionTask#wait(long), org.gradle.api.internal.ConventionTask#wait(), org.gradle.api.internal.ConventionTask#equals(java.lang.Object), org.gradle.api.internal.ConventionTask#hashCode(), org.gradle.api.internal.ConventionTask#getClass(), org.gradle.api.internal.ConventionTask#notify(), org.gradle.api.internal.ConventionTask#notifyAll()`

- - ### Field Detail

    - #### public static final String DEFAULT_EXTENSION

  - ### Constructor Detail

    - #### public Jar()

  - ### Method Detail

    - #### public Manifest getManifest()

      Returns the manifest for this JAR archive.

      Returns:
        The manifest

    - #### @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

    - #### public CopySpec getMetaInf()

    - #### @Input @Override 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

      Returns:
        the character set used to encode JAR metadata like file names
      Since:
        2.14

    - #### public Jar manifest(groovy.lang.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.

    - #### public CopySpec metaInf(groovy.lang.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`

    - #### public void setManifest(Manifest manifest)

      Sets the manifest for this JAR archive.

      Parameters:
        `manifest` - The manifest. May be null.

    - #### @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
      See Also:
        getManifestContentCharset()
      Since:
        2.14

    - #### @Override 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

      Parameters:
        `metadataCharset` - the character set used to encode JAR metadata like file names
      Since:
        2.14