Gradle directories(~300 MB) are getting created for all logins on CI server

We recently updated our CI servers to start using Gradle. Recently we noticed .gradle directories(~300 MB) are getting created under all login profiles on these machines. Wonder if this is related to java “user.home” issues on windows. Any help is appreciated.

‘.gradle’ is created in the home directory of the user who’s running Gradle. Hence, chances are that your CI builds are running under a number of different users.

Well, Jenkins is setup to use dedicated user profile. But what we are seeing is gradle creating .gradle directory for all user profiles. We added a log in build.gradle which prints System.getProperty(“user.home”) and it prints: User home (user.home): C:\WINDOWS\system32\config\systemprofile

Wonder if this issue is related to this java bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4787931

You can actively control where the directory is created by setting the ‘GRADLE_USER_HOME’ environment variable. (Unfortunately, recent versions of the Jenkins Gradle plugin take control of this value, and I don’t know if the environment variable will take effect.) You can print the location that Gradle is using with ‘println gradle.gradleUserHomeDir’.

GRADLE_USER_HOME should work for now. Thanks Peter.