Should the .gradle folder be added to version control?

Gradle creates a folder called .gradle. Should I track it with my version control (i.e. git)?

More importantly, why / why not?

  • How to create a library on Github and use it through gradle dependencies in Android Studio
  • Gradle: How to perform git pull through gradle?
  • Gradle - import GitHub repository and make it a subproject dependency?
  • building java project (gradle build) with git submodule
  • Import an eclipse android project with version control system into Android Studio
  • Loading a library in Gradle using JitPack
  • What is the opposite of `git filter-branch --subdirectory-filter`?
  • Sharing files across branches in Git
  • How to convert a normal Git repository to a bare one?
  • Git: Have one user not fetch/merge changes to specific, otherwise tracked, files
  • Why is the HEAD commit so named?
  • Revert changes to a file in a commit
  • 4 Solutions collect form web for “Should the .gradle folder be added to version control?”

    It’s purely for caching information, you don’t want it in your repo because:

    • it can get big and be full of binary files
    • there can be machine specific data in there
    • there’s a lot of churn in there (you’d be constantly committing changes to files in there)
    • everything in there can be completely re-generated whenever it is needed anyway

    It’s basically a temp directory that Gradle is dropping in the middle of you source code (why Gradle thinks that’s an appropriate thing to do is a different question).

    You can tell the “cache directory” nature of the directory by the name of the switch that lets you change where it goes: “–project-cache-dir”.

    Though I hate having binary files in my source tree, I usually just end up adding the directory to my ignore file because somewhere along the line I’ll forget to use the switch from some command line or from my IDE or something and then end up having to deal with the directory anyway.

    The .gradle folder contains different calculated information about your gradle build (e.g. cached outputs/input information). You definitely shouldn’t check that folder into your version control system.

    You don’t need to keep the .gradle folder.

    Because once you execute gradle build command again, you can make almost the same .gradle folder again.

    But when you use the gradle.setting file under .gradle you might need to move it to root folder of the project.

    when we start the gradle it create the .gradle folder inside your home directory. It consist of native (information about your system) and caches. Caches further consist of plugins and all other jars dependencies.

    When we build the the project first time at that time it download dependencies and plugins and cheched them here. next time when we need them it, it get from here. even when we need them in eclipse to compile the code (=>gradle eclipse), its dependencies are added from cache

    As it will keep updating and adding when you run gradle. so i guess we do not added it to version control.

    Git Baby is a git and github fan, let's start git clone.