Component || Keep?
-------------------------
build.gradle || Yes
settings.gradle || Yes
gradlew || Yes
gradlew.bat || Ideally
.gradle || No
It's considered best practice to check in gradlew
into the code repository. Reason: other developers, testing tools, build tools will get to use the exact same build configuration as you did on your local - thus ensuring consistency and not causing surprise issues that need to be debugged individually.
For multi-project code repositories, top-level has one settings.gradle
while each sub-project should have their own build.gradle
. For multi-project repositories, top-level directory can also have a build.gradle
which is meant to be a way of maintaining common plugins and dependencies for all the subprojects.
settings.gradle
establishes project structure, names of modules, name of top level roots, etc. While build.gradle
is expected to contain plugin requirements (how should these tests run?
, how to get coverage report?
) as well a set of dependencies that the project needs.
The gradlew.bat
file is the gradle wrapper for windows systems -- for full hygiene, I'd check it into VCS, but if you are only concerned with *nix ecosystems, you should be able to remove this file.
Now, going back to the first point I made, depending on the system you are on, gradle init
might produce a different gradle wrapper that might interact with these files in unexpected ways. Hence, it is good practice to check them all into VCS.
I would definitely not check in the .gradle
or /build
directories - it contains bunch of caching and files for temp build steps. These things should be in .gitignore
to ensure optimal local developer speed, but there's not much sense in putting this stuff in VCS.