title: gradle.user.home - set in gradle.properties, build.gradle, or settings.gradle to a project-relative location?
body: <p>By default, <code>gradle.user.home</code> is set to <code>~/.gradle</code> - I'd like to change it to a directory relative to the project, rather than the developer's home directory.</p>
  
  <p>I know you can do so when you invoke gradle, like so:</p>
  
  <pre><code>$ gradle --gradle-user-home=./project-relative-directory
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>$ gradle -Dgradle.user.home=./project-relative-directory
  </code></pre>
  
  <p>I know you can <a href="https://stackoverflow.com/a/55381607/622192">change the location of the build cache</a> by adding the following to settings.gradle:</p>
  
  <pre><code>buildCache {
      local {
          // Set local build cache directory.
          directory = "${settingsDir}/build-cache"
      }
  }
  </code></pre>
  
  <p>But gradle continues to use <code>gradle.user.home</code> for other caching.</p>
  
  <p>The <a href="https://docs.gradle.org/current/userguide/build_environment.html" rel="nofollow noreferrer">manual</a> claims that you can specify <code>gradle.user.home</code> in <code>gradle.properties</code>, like so:</p>
  
  <pre><code>systemProp.gradle.user.home=./project-relative-directory
  </code></pre>
  
  <p>But this doesn't appear to work at all, not for absolute paths or relative paths; although it may be retrieved later via <code>System.get</code>, <code>gradle</code> doesn't appear to make use of it.</p>
  
  <p>Are there any other solutions?</p>