Local cache for a project

I want to run builds in a project with --offline, with the assurance that my dependencies won’t change between builds, even if I run other builds without --offline. This is not possible if my projects use a shared cache, so I figured I should use a separate cache for this particular project. I didn’t find a way to specify only a cache directory – I can only change the location of the GRADLE_USER_HOME. But this way I loose all the settings that are shared in ~/.gradle – gradle.properties, init scripts.

Is there a way to specify only the cache location? Basically, this is what I’d like to have:

task wrapper(type: Wrapper) {

gradleVersion = “2.2.1”

cacheLocation = “$rootDir/.gradle-local-cache” }