Skip to content

Commit

Permalink
build.gradle: remove wrapper task
Browse files Browse the repository at this point in the history
Since Gradle 4.8, overriding built-in tasks, such as the `wrapper` task,
has been deprecated[1] and since Gradle 5.0 would actually produce an
error[2]:

    Cannot add task 'wrapper' as a task with that name already exists

Specifying the gradle version used for executing the build via creating
a "wrapper" task is not required since Gradle will use the version
specified in the `gradle/wrapper/gradle-wrapper.properties` file[3], which
we already have.

As we are planning to upgrade to Gradle 5.2.1, let's remove the wrapper
task.

[1] https://docs.gradle.org/4.8/release-notes.html#overwriting-gradle's-built-in-tasks
[2] https://docs.gradle.org/5.0/userguide/upgrading_version_4.html#potential_breaking_changes

    "Overriding built-in tasks deprecated in 4.8 now produces an error.
     Attempting to replace a built-in task will produce an error similar to
     the following:
         Cannot add task 'wrapper' as a task with that name already exists."

[3] https://docs.gradle.org/5.2.1/userguide/gradle_wrapper.html#sec:adding_wrapper

    "The generated Wrapper properties file,
     gradle/wrapper/gradle-wrapper.properties, stores the information
     about the Gradle distribution.
          The server hosting the Gradle distribution.
          The type of Gradle distribution. ...
          The Gradle version used for executing the build. ... "
  • Loading branch information
fzdy1914 committed Mar 3, 2019
1 parent 5509159 commit 121b135
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ shadowJar {
destinationDir = file("${buildDir}/jar/")
}

task wrapper(type: Wrapper) {
gradleVersion = '4.8.1'
}

task coverage(type: JacocoReport) {
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
classDirectories = files(sourceSets.main.output)
Expand Down

0 comments on commit 121b135

Please sign in to comment.