Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.gradle.api.tasks.wrapper
[Java] Class Wrapper

    java.lang.Object
      org.gradle.api.internal.AbstractTask
          org.gradle.api.DefaultTask
              org.gradle.api.tasks.wrapper.Wrapper

    public class Wrapper
    extends DefaultTask

Generates scripts (for *nix and windows) which allow you to build your project with Gradle, without having to install Gradle.

When a user executes a wrapper script the first time, the script downloads and installs the appropriate Gradle distribution and runs the build against this downloaded distribution. Any installed Gradle distribution is ignored when using the wrapper scripts.

The scripts generated by this task are intended to be committed to your version control system. This task also generates a small `gradle-wrapper.jar` bootstrap JAR file and properties file which should also be committed to your VCS. The scripts delegates to this JAR.

Authors:
  Hans Dockter

Nested Class Summary
`enum` | `Wrapper.PathBase` Specifies how the wrapper path should be interpreted.

Field Summary
`static java.lang.String` | `DEFAULT_ARCHIVE_CLASSIFIER`
`static java.lang.String` | `DEFAULT_ARCHIVE_NAME`
`static java.lang.String` | `DEFAULT_DISTRIBUTION_PARENT_NAME`

Fields inherited from class org.gradle.api.internal.AbstractTask
TASK_NAME, TASK_DESCRIPTION, TASK_GROUP, TASK_TYPE, TASK_DEPENDS_ON, TASK_OVERWRITE, TASK_ACTION

Constructor Summary
`Wrapper()`

Method Summary
`Wrapper.PathBase` | `getArchiveBase()` The archive base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.
`java.lang.String` | `getArchiveClassifier()` The classifier of the archive as part of the download URL.
`java.lang.String` | `getArchiveName()` The name of the archive as part of the download URL.
`java.lang.String` | `getArchivePath()` Returns the path where the gradle distributions archive should be saved (i.e. the parent dir).
`Wrapper.PathBase` | `getDistributionBase()` The distribution base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.
`java.lang.String` | `getDistributionPath()` Returns the path where the gradle distributions needed by the wrapper are unzipped.
`java.lang.String` | `getDistributionUrl()` The URL to download the gradle distribution from.
`java.lang.String` | `getGradleVersion()` Returns the gradle version for the wrapper.
`java.io.File` | `getJarFile()` Returns the file to write the wrapper jar file to.
`java.lang.String` | `getJarPath()` Returns the jar path, relative to the project directory.
`java.io.File` | `getPropertiesFile()` Returns the file to write the wrapper properties to.
`java.lang.String` | `getScriptDestinationPath()` Returns the script destination path, relative to the project directory.
`java.io.File` | `getScriptFile()` Returns the file to write the wrapper script to.
`org.gradle.api.tasks.wrapper.internal.WrapperScriptGenerator` | `getUnixWrapperScriptGenerator()`
`java.lang.String` | `getUrlRoot()` The base URL to download the gradle distribution from.
`void` | `setArchiveBase(Wrapper.PathBase archiveBase)` The archive base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.
`void` | `setArchiveClassifier(java.lang.String archiveClassifier)`
`void` | `setArchiveName(java.lang.String archiveName)`
`void` | `setArchivePath(java.lang.String archivePath)` Set's the path where the gradle distributions archive should be saved (i.e. the parent dir).
`void` | `setDistributionBase(Wrapper.PathBase distributionBase)` The distribution base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.
`void` | `setDistributionPath(java.lang.String distributionPath)` Sets the path where the gradle distributions needed by the wrapper are unzipped.
`void` | `setDistributionUrl(java.lang.String url)`
`void` | `setGradleVersion(java.lang.String gradleVersion)` The version of the gradle distribution required by the wrapper.
`void` | `setJarFile(java.lang.Object jarFile)`
`void` | `setJarPath(java.lang.String jarPath)` When executing the wrapper task, the jar path specifies the path where the gradle-wrapper.jar is copied to.
`void` | `setScriptDestinationPath(java.lang.String scriptDestinationPath)` Specifies a path as the parent dir of the scripts which are generated when executing the wrapper task.
`void` | `setScriptFile(java.lang.Object scriptFile)`
`void` | `setUnixWrapperScriptGenerator(org.gradle.api.tasks.wrapper.internal.WrapperScriptGenerator wrapperScriptGenerator)`
`void` | `setUrlRoot(java.lang.String urlRoot)` Sets the base URL to download the gradle distribution from.

Methods inherited from class org.gradle.api.internal.AbstractTask
org.gradle.api.internal.AbstractTask#setProperty(java.lang.String, java.lang.Object), org.gradle.api.internal.AbstractTask#toString(), org.gradle.api.internal.AbstractTask#compareTo(org.gradle.api.Task), org.gradle.api.internal.AbstractTask#compareTo(java.lang.Object), org.gradle.api.internal.AbstractTask#getName(), org.gradle.api.internal.AbstractTask#getActions(), org.gradle.api.internal.AbstractTask#setName(java.lang.String), org.gradle.api.internal.AbstractTask#getState(), org.gradle.api.internal.AbstractTask#getPath(), org.gradle.api.internal.AbstractTask#getLogger(), org.gradle.api.internal.AbstractTask#execute(), org.gradle.api.internal.AbstractTask#configure(groovy.lang.Closure), org.gradle.api.internal.AbstractTask#configure(groovy.lang.Closure), org.gradle.api.internal.AbstractTask#getDescription(), org.gradle.api.internal.AbstractTask#isEnabled(), org.gradle.api.internal.AbstractTask#captureStandardOutput(org.gradle.api.logging.LogLevel), org.gradle.api.internal.AbstractTask#disableStandardOutputCapture(), org.gradle.api.internal.AbstractTask#property(java.lang.String), org.gradle.api.internal.AbstractTask#setEnabled(boolean), org.gradle.api.internal.AbstractTask#setDescription(java.lang.String), org.gradle.api.internal.AbstractTask#getProject(), org.gradle.api.internal.AbstractTask#getGroup(), org.gradle.api.internal.AbstractTask#setGroup(java.lang.String), org.gradle.api.internal.AbstractTask#dependsOn([Ljava.lang.Object;), org.gradle.api.internal.AbstractTask#getAnt(), org.gradle.api.internal.AbstractTask#getConvention(), org.gradle.api.internal.AbstractTask#hasProperty(java.lang.String), org.gradle.api.internal.AbstractTask#getLogging(), org.gradle.api.internal.AbstractTask#setActions(java.util.List), org.gradle.api.internal.AbstractTask#getTaskDependencies(), org.gradle.api.internal.AbstractTask#getTaskDependencies(), org.gradle.api.internal.AbstractTask#getDependsOn(), org.gradle.api.internal.AbstractTask#setDependsOn(java.lang.Iterable), org.gradle.api.internal.AbstractTask#onlyIf(groovy.lang.Closure), org.gradle.api.internal.AbstractTask#onlyIf(org.gradle.api.specs.Spec), org.gradle.api.internal.AbstractTask#setOnlyIf(org.gradle.api.specs.Spec), org.gradle.api.internal.AbstractTask#setOnlyIf(groovy.lang.Closure), org.gradle.api.internal.AbstractTask#setDidWork(boolean), org.gradle.api.internal.AbstractTask#getDidWork(), org.gradle.api.internal.AbstractTask#doFirst(org.gradle.api.Action), org.gradle.api.internal.AbstractTask#doFirst(groovy.lang.Closure), org.gradle.api.internal.AbstractTask#doLast(org.gradle.api.Action), org.gradle.api.internal.AbstractTask#doLast(groovy.lang.Closure), org.gradle.api.internal.AbstractTask#leftShift(groovy.lang.Closure), org.gradle.api.internal.AbstractTask#deleteAllActions(), org.gradle.api.internal.AbstractTask#getEnabled(), org.gradle.api.internal.AbstractTask#dependsOnTaskDidWork(), org.gradle.api.internal.AbstractTask#getInputs(), org.gradle.api.internal.AbstractTask#getOutputs(), org.gradle.api.internal.AbstractTask#getOutputs(), org.gradle.api.internal.AbstractTask#getTemporaryDir(), org.gradle.api.internal.AbstractTask#setProject(org.gradle.api.Project), org.gradle.api.internal.AbstractTask#getStandardOutputCapture(), org.gradle.api.internal.AbstractTask#getAdditionalProperties(), org.gradle.api.internal.AbstractTask#getDynamicObjectHelper(), org.gradle.api.internal.AbstractTask#setConvention(org.gradle.api.plugins.Convention), org.gradle.api.internal.AbstractTask#getAsDynamicObject(), org.gradle.api.internal.AbstractTask#addValidator(org.gradle.api.internal.tasks.execution.TaskValidator), org.gradle.api.internal.AbstractTask#getValidators(), org.gradle.api.internal.AbstractTask#getExecuter(), org.gradle.api.internal.AbstractTask#setExecuter(org.gradle.api.internal.tasks.TaskExecuter), org.gradle.api.internal.AbstractTask#getOnlyIf(), org.gradle.api.internal.AbstractTask#injectIntoNewInstance(org.gradle.api.internal.project.ProjectInternal, java.lang.String, java.util.concurrent.Callable), org.gradle.api.internal.AbstractTask#wait(long), org.gradle.api.internal.AbstractTask#wait(long, int), org.gradle.api.internal.AbstractTask#wait(), org.gradle.api.internal.AbstractTask#equals(java.lang.Object), org.gradle.api.internal.AbstractTask#hashCode(), org.gradle.api.internal.AbstractTask#getClass(), org.gradle.api.internal.AbstractTask#notify(), org.gradle.api.internal.AbstractTask#notifyAll()

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### DEFAULT_ARCHIVE_CLASSIFIER

    public static final java.lang.String DEFAULT_ARCHIVE_CLASSIFIER

### DEFAULT_ARCHIVE_NAME

    public static final java.lang.String DEFAULT_ARCHIVE_NAME

### DEFAULT_DISTRIBUTION_PARENT_NAME

    public static final java.lang.String DEFAULT_DISTRIBUTION_PARENT_NAME

Constructor Detail

### Wrapper

    public Wrapper()

Method Detail

### getArchiveBase

    public Wrapper.PathBase getArchiveBase()

  The archive base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.

### getArchiveClassifier

    @Deprecated
    public java.lang.String getArchiveClassifier()

  The classifier of the archive as part of the download URL.

  The download URL is assembled by the pattern: `[urlRoot]/[archiveName]-[gradleVersion]-[archiveClassifier].zip`

  The default for the archive classifier is {

  value:
    #DEFAULT_ARCHIVE_CLASSIFIER}.

### getArchiveName

    @Deprecated
    public java.lang.String getArchiveName()

  The name of the archive as part of the download URL.

  The download URL is assembled by the pattern: `[urlRoot]/[archiveName]-[gradleVersion]-[archiveClassifier].zip`

  The default for the archive name is {

  value:
    #DEFAULT_ARCHIVE_NAME}.

### getArchivePath

    public java.lang.String getArchivePath()

  Returns the path where the gradle distributions archive should be saved (i.e. the parent dir). The path is relative to the archive base directory.

### getDistributionBase

    public Wrapper.PathBase getDistributionBase()

  The distribution base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.

### getDistributionPath

    public java.lang.String getDistributionPath()

  Returns the path where the gradle distributions needed by the wrapper are unzipped. The path is relative to the distribution base directory
  See Also:
    setDistributionPath(String)

### getDistributionUrl

    @Input
    public java.lang.String getDistributionUrl()

  The URL to download the gradle distribution from.

  If not set, the download URL is assembled by the pattern: `[urlRoot]/[archiveName]-[gradleVersion]-[archiveClassifier].zip`

  The wrapper downloads a certain distribution only once and caches it. If your distribution base is the project, you might submit the distribution to your version control system. That way no download is necessary at all. This might be in particular interesting, if you provide a custom gradle snapshot to the wrapper, because you don't need to provide a download server then.

### getGradleVersion

    public java.lang.String getGradleVersion()

  Returns the gradle version for the wrapper.
  See Also:
    setGradleVersion(String)

### getJarFile

    @OutputFile
    public java.io.File getJarFile()

  Returns the file to write the wrapper jar file to.

### getJarPath

    @Deprecated
    public java.lang.String getJarPath()

  Returns the jar path, relative to the project directory.
  See Also:
    setJarPath(String)

### getPropertiesFile

    @OutputFile
    public java.io.File getPropertiesFile()

  Returns the file to write the wrapper properties to.

### getScriptDestinationPath

    @Deprecated
    public java.lang.String getScriptDestinationPath()

  Returns the script destination path, relative to the project directory.
  See Also:
    setScriptDestinationPath(String)

### getScriptFile

    @OutputFile
    public java.io.File getScriptFile()

  Returns the file to write the wrapper script to.

### getUnixWrapperScriptGenerator

    public org.gradle.api.tasks.wrapper.internal.WrapperScriptGenerator getUnixWrapperScriptGenerator()

### getUrlRoot

    @Deprecated
    public java.lang.String getUrlRoot()

  The base URL to download the gradle distribution from.

  The download URL is assembled by the pattern: `[urlRoot]/[archiveName]-[gradleVersion]-[archiveClassifier].zip`

### setArchiveBase

    public void setArchiveBase(Wrapper.PathBase archiveBase)

  The archive base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.

### setArchiveClassifier

    @Deprecated
    public void setArchiveClassifier(java.lang.String archiveClassifier)

### setArchiveName

    @Deprecated
    public void setArchiveName(java.lang.String archiveName)

### setArchivePath

    public void setArchivePath(java.lang.String archivePath)

  Set's the path where the gradle distributions archive should be saved (i.e. the parent dir). The path is relative to the parent dir specified with getArchiveBase().

### setDistributionBase

    public void setDistributionBase(Wrapper.PathBase distributionBase)

  The distribution base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.

### setDistributionPath

    public void setDistributionPath(java.lang.String distributionPath)

  Sets the path where the gradle distributions needed by the wrapper are unzipped. The path is relative to the distribution base directory
  See Also:
    setDistributionPath(String)

### setDistributionUrl

    public void setDistributionUrl(java.lang.String url)

### setGradleVersion

    public void setGradleVersion(java.lang.String gradleVersion)

  The version of the gradle distribution required by the wrapper. This is usually the same version of Gradle you use for building your project.

### setJarFile

    public void setJarFile(java.lang.Object jarFile)

### setJarPath

    @Deprecated
    public void setJarPath(java.lang.String jarPath)

  When executing the wrapper task, the jar path specifies the path where the gradle-wrapper.jar is copied to. The jar path must be a path relative to the project dir. The gradle-wrapper.jar must be submitted to your version control system. Defaults to empty string, i.e. the jar is placed into the project root dir.

### setScriptDestinationPath

    @Deprecated
    public void setScriptDestinationPath(java.lang.String scriptDestinationPath)

  Specifies a path as the parent dir of the scripts which are generated when executing the wrapper task. This path specifies a directory relative to the project dir. Defaults to empty string, i.e. the scripts are placed into the project root dir.
  Parameters:
    `scriptDestinationPath` - Any object which `toString` method specifies the path. Most likely a String or File object.

### setScriptFile

    public void setScriptFile(java.lang.Object scriptFile)

### setUnixWrapperScriptGenerator

    public void setUnixWrapperScriptGenerator(org.gradle.api.tasks.wrapper.internal.WrapperScriptGenerator wrapperScriptGenerator)

### setUrlRoot

    @Deprecated
    public void setUrlRoot(java.lang.String urlRoot)

  Sets the base URL to download the gradle distribution from.

Groovy Documentation