Gradle downloads to ?/.gradle directory when running tasks

Viewed 878

Gradle created a ?/.gradle/ in the directory that gradle was run in. We would expect the cache directory to be created at ~/.gradle.

Example:

/project           # Project root and cwd when running gradle command
    /.gradle       # Expected - project-specific gradle folder
    /?             # Directory literally named with a question mark
        /.gradle   # Unexpected - Global gradle folder with wrappers and cached artifacts
3 Answers

let's find it out why it behaves like this.
As gradle use following code to get user home:
System.getProperty("user.home"); Follow the link for openjdk 8 source code. It comes to conclusion: When JVM can not found user name in os, it will use ? as a return. So gradle will create ?/.gradle for usage.

Related