Is there a setting to move project specific .gradle cache directory out of the source area? I’m basically trying to keep the source area clean of build artefacts.

I’ve changed GRADLE_USER_HOME and now caches, daemon, native, notifications, wrapper directories appear under .gradle in the new location.

I’m still getting a .gradle directory created in my source area with sub-directories: 5.4, buildOutputCleanup, vcs-1.

Alternatively - is there a setting to get Gradle to remove the project/.gradle directory as soon as the build is finished, even on build failure, or to not create it at all?

Here it suggests that the project specific cache is cleaned and only contains 5.4 or equivalent. Maybe there is a way to force the clean?

I’m using Gradle 5.4 and supplying -Dorg.gradle.daemon=false