Class Wrapper
- All Implemented Interfaces:
- Comparable<Task>,- org.gradle.api.internal.DynamicObjectAware,- org.gradle.api.internal.TaskInternal,- Named,- ExtensionAware,- Task,- Configurable<Task>
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.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumSpecifies the Gradle distribution type.static enumSpecifies how the wrapper path should be interpreted.Nested classes/interfaces inherited from interface org.gradle.api.TaskTask.Namer
- 
Field SummaryFieldsFields inherited from interface org.gradle.api.TaskTASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionThe archive base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.Returns the path where the gradle distributions archive should be saved (i.e.The list of available gradle distribution types.Returns the file to write the wrapper batch script to.The distribution base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.Returns the path where the gradle distributions needed by the wrapper are unzipped.The SHA-256 hash sum of the gradle distribution.Returns the type of the Gradle distribution to be used by the wrapper.The URL to download the gradle distribution from.protected org.gradle.api.internal.file.FileLookupReturns the gradle version for the wrapper.Returns the file to write the wrapper jar file to.The network timeout specifies how many ms to wait for when the wrapper is performing network operations, such as downloading the wrapper jar.Returns the file to write the wrapper properties to.Returns the file to write the wrapper script to.Indicates if this task will validate the distribution url that has been configured.voidsetArchiveBase(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.voidsetArchivePath(String archivePath) Set's the path where the gradle distributions archive should be saved (i.e.voidsetDistributionBase(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.voidsetDistributionPath(String distributionPath) Sets the path where the gradle distributions needed by the wrapper are unzipped.voidsetDistributionSha256Sum(String distributionSha256Sum) The SHA-256 hash sum of the gradle distribution.voidsetDistributionType(Wrapper.DistributionType distributionType) The type of the Gradle distribution to be used by the wrapper.voidsetDistributionUrl(String url) The URL to download the gradle distribution from.voidsetGradleVersion(String gradleVersion) The version of the gradle distribution required by the wrapper.voidsetJarFile(File jarFile) The file to write the wrapper jar file to.voidsetJarFile(Object jarFile) The file to write the wrapper jar file to.voidsetScriptFile(File scriptFile) The file to write the wrapper script to.voidsetScriptFile(Object scriptFile) The file to write the wrapper script to.voidsetWrapperVersionsResources(WrapperVersionsResources wrapperVersionsResources) Set Wrapper versions resources.Methods inherited from class org.gradle.api.DefaultTaskcompareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTaskacceptServiceReferences, appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjectsMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.TaskdoNotTrackState, getConvention, notCompatibleWithConfigurationCache
- 
Field Details- 
DEFAULT_DISTRIBUTION_PARENT_NAME- See Also:
 
 
- 
- 
Constructor Details- 
Wrapperpublic Wrapper()
 
- 
- 
Method Details- 
getScriptFileReturns the file to write the wrapper script to.
- 
setScriptFileThe file to write the wrapper script to.- Since:
- 4.0
 
- 
setScriptFileThe file to write the wrapper script to.
- 
getBatchScriptReturns the file to write the wrapper batch script to.
- 
getJarFileReturns the file to write the wrapper jar file to.
- 
setJarFileThe file to write the wrapper jar file to.- Since:
- 4.0
 
- 
setJarFileThe file to write the wrapper jar file to.
- 
getPropertiesFileReturns the file to write the wrapper properties to.
- 
getDistributionPathReturns the path where the gradle distributions needed by the wrapper are unzipped. The path is relative to the distribution base directory- See Also:
 
- 
setDistributionPathSets the path where the gradle distributions needed by the wrapper are unzipped. The path is relative to the distribution base directory- See Also:
 
- 
setWrapperVersionsResources@Incubating public void setWrapperVersionsResources(WrapperVersionsResources wrapperVersionsResources) Set Wrapper versions resources.- Since:
- 8.1
 
- 
getGradleVersionReturns the gradle version for the wrapper.- Throws:
- GradleException- if the label that can be provided via- setGradleVersion(String)can not be resolved at the moment. For example, there is not a `release-candidate` available at all times.
- See Also:
 
- 
setGradleVersionThe version of the gradle distribution required by the wrapper. This is usually the same version of Gradle you use for building your project. The following labels are allowed to specify a version:latest,release-candidate,nightly, andrelease-nightlyThe resulting distribution url is validated before it is written to the gradle-wrapper.properties file. 
- 
getDistributionTypeReturns the type of the Gradle distribution to be used by the wrapper.- See Also:
 
- 
setDistributionTypeThe type of the Gradle distribution to be used by the wrapper. By default, this isWrapper.DistributionType.BIN, which is the binary-only Gradle distribution without documentation.- See Also:
 
- 
getAvailableDistributionTypesThe list of available gradle distribution types.
- 
getDistributionUrlThe URL to download the gradle distribution from.If not set, the download URL is the default for the specified getGradleVersion().If getGradleVersion()is not set, will return null.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. 
- 
setDistributionUrlThe URL to download the gradle distribution from.If not set, the download URL is the default for the specified getGradleVersion().If getGradleVersion()is not set, will return null.The wrapper downloads a certain distribution 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. The distribution url is validated before it is written to the gradle-wrapper.properties file. 
- 
getDistributionSha256SumThe SHA-256 hash sum of the gradle distribution.If not set, the hash sum of the gradle distribution is not verified. The wrapper allows for verification of the downloaded Gradle distribution via SHA-256 hash sum comparison. This increases security against targeted attacks by preventing a man-in-the-middle attacker from tampering with the downloaded Gradle distribution. - Since:
- 4.5
 
- 
setDistributionSha256SumThe SHA-256 hash sum of the gradle distribution.If not set, the hash sum of the gradle distribution is not verified. The wrapper allows for verification of the downloaded Gradle distribution via SHA-256 hash sum comparison. This increases security against targeted attacks by preventing a man-in-the-middle attacker from tampering with the downloaded Gradle distribution. - Since:
- 4.5
 
- 
getDistributionBaseThe distribution base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.
- 
setDistributionBaseThe distribution base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.
- 
getArchivePathReturns the path where the gradle distributions archive should be saved (i.e. the parent dir). The path is relative to the archive base directory.
- 
setArchivePathSet'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 withgetArchiveBase().
- 
getArchiveBaseThe archive base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.
- 
setArchiveBaseThe archive base specifies whether the unpacked wrapper distribution should be stored in the project or in the gradle user home dir.
- 
getNetworkTimeoutThe network timeout specifies how many ms to wait for when the wrapper is performing network operations, such as downloading the wrapper jar.- Since:
- 7.6
 
- 
getValidateDistributionUrlIndicates if this task will validate the distribution url that has been configured.- Returns:
- whether this task will validate the distribution url
- Since:
- 8.2
 
- 
getFileLookup@Inject protected org.gradle.api.internal.file.FileLookup getFileLookup()
 
-