Why are the .gradle folder and the Gradle repository in it so messy?

Why can’t the Gradle repository be as neat as the Maven repository? Every time I check whether the javadoc and source code have been downloaded, I have to search for a long time. And there are many strange files in the .gradle folder. I think we can consider making the repository independent like Maven

The Maven “repository” is not a repository.
It is a great misconception and broken by design.
It is a mixture of a local repository and a download cache, which causes big problems, especially when a Gradle build is conifigured to use it as it is quite normal that it contains corrupted / incomplete state.

What you refer to as “Gradle repository” is where Gradle caches all sorts of things, including downloaded dependencies. Of course Gradle could be rewritten to do it like Maven, but why should it be? To become shitty, slow, and unusable? Gradle is awesome at avoiding work and for that it needs various caches and optimizations. The contents of .gradle are not meant for human consumption, but for Gradle being able to do awesome and blazing fast actions. So it would be a big mistake to sacrifice functionality and speed for human consumption of something that is not at all meant for human consumption.

Besides that, <GRADLE_USER_HOME>/caches/modules-2/files-2.1 is not that much different to the “Maven repository”, it just has one more intermediate directory that contains a checksum and it is not really that hard to do something like

ls /d/Dateien/.gradle/caches/modules-2/files-2.1/xml-apis/xml-apis/1.4.01/*/*-{javadoc,sources}.jar

or

find /d/Dateien/.gradle/caches/modules-2/files-2.1/ -type f -name '*-javadoc.jar' -or -name '*-sources.jar'

if you really need to investigate it.

1 Like