What is the Gradle wrapper and why should you use it?

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ส.ค. 2024
  • The Gradle wrapper is a script that can be added to your Gradle project and used to execute your build. In this video we'll talk about the key advantages of the Gradle wrapper, such as not needing to have Gradle installed on your machine in order to execute your build. Plus we'll run through how to apply and use the wrapper in your own project.
    THIS VIDEO IN ARTICLE FORMAT
    Check out this article on the same topic on my blog tomgregory.com...
    DOCS
    To learn more about configuring the Gradle wrapper, see these Gradle docs docs.gradle.or...
    CORRECTIONS
    In Gradle 7+ you can no longer run "gradle wrapper" in an empty directory. Please use "gradle init" instead for new projects and "gradle wrapper" within existing projects. Here's the breaking change docs.gradle.or...
    🚀 FREE INTRODUCTORY GRADLE COURSE tomgregory.com...
    📖 ULTIMATE GRADLE BUILD BIBLE tomgregory.com...
    🌍 Check out my website tomgregory.com...
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 47

  • @TomGregoryTech
    @TomGregoryTech  3 ปีที่แล้ว

    ►► Getting started with Gradle just got much easier. Check out my FREE Get Going with Gradle course → learn.tomgregory.com/courses/get-going-with-gradle

  • @NR-pf9zp
    @NR-pf9zp 3 ปีที่แล้ว +2

    This is quite an excellent tutorial. lucid and helpful

  • @anison1111
    @anison1111 3 ปีที่แล้ว +2

    Good work - thorough and the hawaiin music of whatever it is that you have there

  • @manueljordan317
    @manueljordan317 3 ปีที่แล้ว +1

    Thanks for this valuable tutorial!

  • @noahmatallah2594
    @noahmatallah2594 4 ปีที่แล้ว +2

    Keep it up tom, I really love what you're doing here, Nice video!

  • @PulpFreePress
    @PulpFreePress 3 ปีที่แล้ว +1

    Very helpful, thanks! I needed a quick refresher and this was perfect.

  • @Akio_F
    @Akio_F หลายเดือนก่อน

    Thanks, that was helpful

  • @mariocalderon2148
    @mariocalderon2148 2 ปีที่แล้ว

    Thank you very much for this and all your tutorials. I have learned a lot by them!

  • @user-sz1jw2wt7v
    @user-sz1jw2wt7v ปีที่แล้ว

    Thank you Tom!

  • @sufyanshoaib
    @sufyanshoaib 3 ปีที่แล้ว

    Nicely explained. Just one clarification required, in the last minute of the video around 7th min, you have explained if we use `./gradlew build` it will use version 6.2.2 as specified by project. But if I understood correct, it should be using gradle 6.2.1 version which is specified by project.

    • @TomGregoryTech
      @TomGregoryTech  3 ปีที่แล้ว

      Hi Muhammad. In the video I run:
      ./gradlew wrapper --gradle-version 6.2.2
      This means the version used by the gradlew script from that point on will be 6.2.2.

  • @bojorquezja
    @bojorquezja 4 ปีที่แล้ว +1

    Tks for the information!

  • @antonhen23
    @antonhen23 3 ปีที่แล้ว +1

    Thanks a lot!

    • @TomGregoryTech
      @TomGregoryTech  3 ปีที่แล้ว

      No probs! Hope it helped you understand the Gradle wrapper.

  • @maheshj336
    @maheshj336 3 ปีที่แล้ว +1

    In gradle 7, I tried creating a empty folder to test out the wrapper. But looks like it is no more supported.
    I get this below error
    "$ gradle wrapper
    FAILURE: Build failed with an exception.
    * What went wrong:
    Executing Gradle tasks as part of a build without a settings file is not supported."
    using "gradle init" works.
    Liked your video. thanks for this.

    • @TomGregoryTech
      @TomGregoryTech  3 ปีที่แล้ว +1

      Hi Mahesh. Thanks for bringing this problem to my attention. It was introduced in Gradle 7+. The workaround is to use "gradle init" instead.
      I created this issue in the Gradle GitHub repository github.com/gradle/gradle/issues/17625 and I'll add a note to this video so viewers are aware.

  • @ruchiverma1279
    @ruchiverma1279 3 ปีที่แล้ว

    Hi, I saw one of your videos on Gradle and it's really great. I am a novice to Gradle and keen to follow further videos on your channel. I am looking for some pointers for one of the tasks assigned to me in my assignment. There is a maven plugin and i need to make that plugin to be used in the Gradle projects. Can you guide me on what should be my starting point?

    • @TomGregoryTech
      @TomGregoryTech  3 ปีที่แล้ว

      Hi Ruchi. Are you doing a Maven > Gradle migration? It's likely there is a corresponding plugin in Gradle. Here are some pointers docs.gradle.org/current/userguide/migrating_from_maven.html#migmvn:common_plugins

  • @boots_on_the_grounds_of_war
    @boots_on_the_grounds_of_war 5 หลายเดือนก่อน

    Running "gradle init" automatically creates the gradle wrappers. I'm not sure if things have changed since this video, but I didn't need to call "gradle wrapper".

    • @TomGregoryTech
      @TomGregoryTech  5 หลายเดือนก่อน

      Hi. Just call the wrapper task when you need to update the Gradle version.

  • @prabudhabharatbansode8023
    @prabudhabharatbansode8023 ปีที่แล้ว

    I had have changed the Gradle versions to many times to resolve this issue but still facing issue of deprecation in my local for Gradle version.
    Compile time: "Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0."
    Any idea to resolve this ?
    Reply Thanks

    • @TomGregoryTech
      @TomGregoryTech  ปีที่แล้ว

      Hi. This is just a warning to say that when Gradle 8 is released you'll have a problem updating. Run your build again with "--warning-mode=all" to get more details on the problems, to help you fix them.

  • @milon27
    @milon27 2 ปีที่แล้ว

    would you create a video ,
    how android studio setting up a android project using Gradle. its a lot of files and configuration .very confusing
    would glad if you create video on that
    thank you.

    • @TomGregoryTech
      @TomGregoryTech  2 ปีที่แล้ว +1

      Cool. Thanks for the suggestion!

    • @milon27
      @milon27 2 ปีที่แล้ว

      @@TomGregoryTech thank you

  • @manueljordan317
    @manueljordan317 3 ปีที่แล้ว

    I have Windows and installed the 'git bash' ... just being curious, what did you do to get the tree and cat commands available in the Git bash? I got for example 'bash: tree: command not found' , but for other commands such as `ls -als` it works fine. Thanks in advance for the support

    • @TomGregoryTech
      @TomGregoryTech  3 ปีที่แล้ว +1

      Hi Manuel. "cat" comes by default with Git bash. You can access Windows tree command it Git bash using "cmd //c tree"

    • @manueljordan317
      @manueljordan317 3 ปีที่แล้ว +1

      @@TomGregoryTech Oh my mistake, yes about cat command, thanks for the "cmd //c tree", covered here too: superuser.com/questions/531592/how-do-i-add-the-tree-command-to-git-bash-on-windows
      Thanks for your videos!

    • @manueljordan317
      @manueljordan317 3 ปีที่แล้ว

      Seems you created an alias for "cmd //c tree" right?

    • @TomGregoryTech
      @TomGregoryTech  3 ปีที่แล้ว +1

      @@manueljordan317 Yes it was on an old machine but I imagine that's how I set it up.

    • @manueljordan317
      @manueljordan317 3 ปีที่แล้ว

      @@TomGregoryTech thanks, keep doing your excellent videos!

  • @manueljordan317
    @manueljordan317 3 ปีที่แล้ว

    At 05:29 - Was the 'gradle-wrapper.properties' file updated too? It about for the 'distributionUrl' value

    • @TomGregoryTech
      @TomGregoryTech  3 ปีที่แล้ว +1

      Yes that's right Manuel. I go into more details in the video How to update Gradle th-cam.com/video/j9HkNOePXjs/w-d-xo.html

    • @manueljordan317
      @manueljordan317 3 ปีที่แล้ว

      @@TomGregoryTech Huge thanks!, your playlist is very valuable! already subscribed!

  • @willemevenwel
    @willemevenwel 2 ปีที่แล้ว

    qq - why doesnt "gradlew init" provide a 'java' option and only groovy and kotlin?
    also, thanks for great vids!

    • @TomGregoryTech
      @TomGregoryTech  2 ปีที่แล้ว

      Hey Willem. In gradle init select "2. application" for type of project then you will see the "Java" option. The Groovy vs. Kotlin option is for the Gradle build script itself.

    • @willemevenwel
      @willemevenwel 2 ปีที่แล้ว

      @@TomGregoryTech thanks for the answer/guidance and your prompt response!

  • @notdead1060
    @notdead1060 3 ปีที่แล้ว

    hey, Tom in 4:16 you build the project then where can I get the debug.apk?
    Nice Tutorial

    • @TomGregoryTech
      @TomGregoryTech  3 ปีที่แล้ว

      Thanks. Sorry not sure what you're asking though.

    • @notdead1060
      @notdead1060 3 ปีที่แล้ว

      @@TomGregoryTech thanks for your reply buddy but yeah my question was incomplete but I figure it out.

  • @PianoSurRia
    @PianoSurRia 3 ปีที่แล้ว

    Nobody wondered why a gradle wrapper was created at all? Why is there no such thing in other instruments? Because the they have made so many incompatibilities and redundant features that they confused themselves and are tired of supporting them

  • @GauravSharma-wb9se
    @GauravSharma-wb9se 2 ปีที่แล้ว

    please remove irritating sound in between all the time

    • @TomGregoryTech
      @TomGregoryTech  2 ปีที่แล้ว

      Thanks for checking out the video Gaurav. If I could go back and remove the sound, I would :)