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
Class Wrapper

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

    class Wrapper
    extends DefaultTask

The wrapper task generates scripts (for *nix and windows) which enable to build your project with Gradle, without having to install Gradle. The scripts generated by this task are supposed to be commited to your version control system. This tasks also copies a gradle-wrapper.jar to your project dir which needs also be commited into your VCS. The scripts delegates to this jar. If a user execute a wrapper script the first time, the script downloads the gradle-distribution and runs the build against the downloaded distribution. Any installed Gradle distribution is ignored when using the wrapper scripts. Alternatively you can store the distribution for the wrapper in your version control system.

author:
  Hans Dockter

Nested Class Summary
`enum` | `Wrapper.PathBase`

Field Summary
`static java.lang.String` | `DEFAULT_ARCHIVE_CLASSIFIER`
`static java.lang.String` | `DEFAULT_ARCHIVE_NAME`
`static java.lang.String` | `DEFAULT_DISTRIBUTION_PARENT_NAME`
`static java.lang.String` | `DEFAULT_URL_ROOT`
`static java.lang.String` | `DISTRIBUTION_BASE_PROPERTY`
`static java.lang.String` | `DISTRIBUTION_CLASSIFIER_PROPERTY`
`static java.lang.String` | `DISTRIBUTION_NAME_PROPERTY`
`static java.lang.String` | `DISTRIBUTION_PATH_PROPERTY`
`static java.lang.String` | `DISTRIBUTION_VERSION_PROPERTY`
`static java.lang.String` | `URL_ROOT_PROPERTY`
`static java.lang.String` | `WRAPPER_DIR`
`static java.lang.String` | `WRAPPER_JAR`
`static java.lang.String` | `WRAPPER_JAR_BASE_NAME`
`static java.lang.String` | `WRAPPER_PROPERTIES`
`static java.lang.String` | `ZIP_STORE_BASE_PROPERTY`
`static java.lang.String` | `ZIP_STORE_PATH_PROPERTY`

Constructor Summary
`Wrapper(Project project, java.lang.String name)`

Method Summary
`void` | `generate()`
`PathBase` | `getArchiveBase()` Returns the archive base.
`java.lang.String` | `getArchiveClassifier()` Returns the archive classifier.
`java.lang.String` | `getArchiveName()` Returnes the archive name.
`java.lang.String` | `getArchivePath()` Returns the archive path.
`PathBase` | `getDistributionBase()` Returns the distribution base.
`java.lang.String` | `getDistributionPath()` Returns the distribution path.
`java.lang.String` | `getGradleVersion()` Returns the gradle version for the wrapper.
`java.lang.String` | `getJarPath()` Returns the jar path.
`java.lang.String` | `getScriptDestinationPath()` Returns the script destination path.
`WrapperScriptGenerator` | `getUnixWrapperScriptGenerator()`
`java.lang.String` | `getUrlRoot()`
`void` | `setArchiveBase(PathBase archiveBase)` The distribution 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)` Specifies the classifier of the archive as part of the download URL.
`void` | `setArchiveName(java.lang.String archiveName)` Specifies the name of the archive as part of the download URL.
`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(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)` Set's the path where the gradle distributions needed by the wrapper are unzipped.
`void` | `setGradleVersion(java.lang.String gradleVersion)` The version of the gradle distribution required by the wrapper.
`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` | `setUnixWrapperScriptGenerator(WrapperScriptGenerator wrapperScriptGenerator)`
`void` | `setUrlRoot(java.lang.String urlRoot)` A URL where to download the gradle distribution from.
`Wrapper` | `valueOf(java.lang.String name)` Returns the enum constant of this type with the specified name.
`Wrapper[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

Methods inherited from class DefaultTask
leftShift

Field Detail

### DEFAULT_ARCHIVE_CLASSIFIER

    static final java.lang.String DEFAULT_ARCHIVE_CLASSIFIER

### DEFAULT_ARCHIVE_NAME

    static final java.lang.String DEFAULT_ARCHIVE_NAME

### DEFAULT_DISTRIBUTION_PARENT_NAME

    static final java.lang.String DEFAULT_DISTRIBUTION_PARENT_NAME

### DEFAULT_URL_ROOT

    static final java.lang.String DEFAULT_URL_ROOT

### DISTRIBUTION_BASE_PROPERTY

    static final java.lang.String DISTRIBUTION_BASE_PROPERTY

### DISTRIBUTION_CLASSIFIER_PROPERTY

    static final java.lang.String DISTRIBUTION_CLASSIFIER_PROPERTY

### DISTRIBUTION_NAME_PROPERTY

    static final java.lang.String DISTRIBUTION_NAME_PROPERTY

### DISTRIBUTION_PATH_PROPERTY

    static final java.lang.String DISTRIBUTION_PATH_PROPERTY

### DISTRIBUTION_VERSION_PROPERTY

    static final java.lang.String DISTRIBUTION_VERSION_PROPERTY

### URL_ROOT_PROPERTY

    static final java.lang.String URL_ROOT_PROPERTY

### WRAPPER_DIR

    static final java.lang.String WRAPPER_DIR

### WRAPPER_JAR

    static final java.lang.String WRAPPER_JAR

### WRAPPER_JAR_BASE_NAME

    static final java.lang.String WRAPPER_JAR_BASE_NAME

### WRAPPER_PROPERTIES

    static final java.lang.String WRAPPER_PROPERTIES

### ZIP_STORE_BASE_PROPERTY

    static final java.lang.String ZIP_STORE_BASE_PROPERTY

### ZIP_STORE_PATH_PROPERTY

    static final java.lang.String ZIP_STORE_PATH_PROPERTY

Constructor Detail

### Wrapper

    public Wrapper(Project project, java.lang.String name)

Method Detail

### generate

    @TaskAction
    public void generate()

### getArchiveBase

    public PathBase getArchiveBase()

  Returns the archive base.
  see:
    #setArchiveBase(org.gradle.api.tasks.wrapper.Wrapper.PathBase)

### getArchiveClassifier

    public java.lang.String getArchiveClassifier()

  Returns the archive classifier.
  see:
    #setArchiveClassifier(String)

### getArchiveName

    public java.lang.String getArchiveName()

  Returnes the archive name.
  see:
    #setArchiveName(String)

### getArchivePath

    public java.lang.String getArchivePath()

  Returns the archive path.
  see:
    #setArchivePath(String)

### getDistributionBase

    public PathBase getDistributionBase()

  Returns the distribution base.
  see:
    #setDistributionBase(org.gradle.api.tasks.wrapper.Wrapper.PathBase)

### getDistributionPath

    public java.lang.String getDistributionPath()

  Returns the distribution path.
  see:
    #setDistributionPath(String)

### getGradleVersion

    public java.lang.String getGradleVersion()

  Returns the gradle version for the wrapper.
  see:
    #setGradleVersion(String)

### getJarPath

    public java.lang.String getJarPath()

  Returns the jar path.
  see:
    #setJarPath(String)

### getScriptDestinationPath

    public java.lang.String getScriptDestinationPath()

  Returns the script destination path.
  see:
    #setScriptDestinationPath(String)

### getUnixWrapperScriptGenerator

    public WrapperScriptGenerator getUnixWrapperScriptGenerator()

### getUrlRoot

    public java.lang.String getUrlRoot()

### setArchiveBase

    public void setArchiveBase(PathBase archiveBase)

  The distribution base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir. The path specified in #getArchivePath() is a relative path to etiher of those dirs.
  param:
    archiveBase

### setArchiveClassifier

    public void setArchiveClassifier(java.lang.String archiveClassifier)

  Specifies the classifier of the archive as part of the download URL. The download URL is assembled by the pattern: `#getUrlRoot()/#getArchiveName()-#getArchiveClassifier()-#getGradleVersion().zip` The default for the archive classifier is #DEFAULT_ARCHIVE_CLASSIFIER.
  param:
    archiveClassifier

### setArchiveName

    public void setArchiveName(java.lang.String archiveName)

  Specifies the name of the archive as part of the download URL. The download URL is assembled by the pattern: `#getUrlRoot()/#getArchiveName()-#getArchiveClassifier()-#getGradleVersion().zip` The default for the archive name is #DEFAULT_ARCHIVE_NAME.
  param:
    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().
  param:
    archivePath

### setDistributionBase

    public void setDistributionBase(PathBase distributionBase)

  The distribution base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir. The path specified in #distributionPath is a relative path to either of those dirs.
  param:
    distributionBase

### setDistributionPath

    public void setDistributionPath(java.lang.String distributionPath)

  Set's the path where the gradle distributions needed by the wrapper are unzipped. The path is relative to the dir specified with #distributionBase.
  param:
    distributionPath

### 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.
  param:
    gradleVersion

### setJarPath

    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.
  param:
    jarPath

### setScriptDestinationPath

    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.
  param:
    scriptDestinationPath Any object which `toString` method specifies the path. Most likely a String or File object.

### setUnixWrapperScriptGenerator

    public void setUnixWrapperScriptGenerator(WrapperScriptGenerator wrapperScriptGenerator)

### setUrlRoot

    public void setUrlRoot(java.lang.String urlRoot)

  A URL where to download the gradle distribution from. The pattern used by the wrapper for downloading is: `#getUrlRoot()/#getArchiveName()-#getArchiveClassifier()-#getGradleVersion().zip`. The default for the URL root is #DEFAULT_URL_ROOT. The wrapper downloads a certain distribution only ones and caches it. If your #getDistributionBase() 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.
  param:
    urlRoot

### valueOf

    Wrapper valueOf(java.lang.String name)

  Returns the enum constant of this type with the specified name.

### values

    Wrapper[] values()

  Returns an array containing the constants of this enum type, in the order they are declared.

Groovy Documentation