When Maven came out some twelve years ago, the Java community became comfortable with not checking in third-party binaries. In the Ant era, before that, you did. Maybe we were being kind to source control systems, but we opened a new can of worms.
While I spent a lot of time being an advocate of that design, I’m not any more. It’s time we checked in binaries again, and yes that means even into Git (where small repos historically rule).
Gradle is a very elegant and terse build grammar for the Java eco-system. Inside their main SDK download, there is a “samples/webApplication/quickstart” folder that has a neat minimalist “hello world” web app. Putting that under source control with “git init” is easy :)
cd samples/webApplication/quickstart git init wget --no-check-certificate https://www.gitignore.io/api/java,maven,gradle --output-document=.gitignore mkdir gradle_home gradle --gradle-user-home gradle_home war git add gradle_home git commit -am "check in downloaded jars n all"
But if you run the gradle line again, it does things that would result in another checkin, when it should not In my opinion:
modified: gradle_home/caches/2.1/scripts/build_jmcktaacs2o3f7glfb3tb17ev/ProjectScript/buildscript/cache.properties modified: gradle_home/caches/2.1/scripts/build_jmcktaacs2o3f7glfb3tb17ev/ProjectScript/buildscript/cache.properties.lock modified: gradle_home/caches/2.1/scripts/build_jmcktaacs2o3f7glfb3tb17ev/ProjectScript/no_buildscript/cache.properties modified: gradle_home/caches/2.1/scripts/build_jmcktaacs2o3f7glfb3tb17ev/ProjectScript/no_buildscript/cache.properties.lock deleted: gradle_home/caches/2.1/scripts/build_jmcktaacs2o3f7glfb3tb17ev/ProjectScript/no_buildscript/classes/build_jmcktaacs2o3f7glfb3tb17ev$_run_closure3.class deleted: gradle_home/caches/2.1/scripts/build_jmcktaacs2o3f7glfb3tb17ev/ProjectScript/no_buildscript/classes/build_jmcktaacs2o3f7glfb3tb17ev$_run_closure3_closure4.class modified: gradle_home/caches/2.1/scripts/build_jmcktaacs2o3f7glfb3tb17ev/ProjectScript/no_buildscript/classes/build_jmcktaacs2o3f7glfb3tb17ev.class modified: gradle_home/caches/modules-2/modules-2.lock
Too bad. Maybe Gradle 3 will rework the caches folder to more clearly separate sections that can be checked in, from those that should not be.
I didn’t try Maven as I could not work out how to redirect the local repository without changing settings.xml for all projects.