Temporary folder (/tmp) filled up with gradle_uploadXXXSHA1 files


I configured my CI server to publish artifacts in an ivy local repository. So it does it about every minute :slight_smile: Each time, this leads to a gradle_uploadXXXSHA1 file into /tmp for each artifact for each build that seems never cleaned up. several hundreds files per day :confused:

I use with gradle 1.11, below is my publishing conf.

Is this a known bug, or is there an option to avoid this ?

publishing {
      repositories {
        ivy {
          url "${System.properties['user.home']}/.ivy2/local"
      publications {
        ivy(IvyPublication) {
          organisation 'xxx'
          from components.java
          artifact(sourcesJar) {
            type 'sources'

I use 2.0 and I face the same problem. My CI server is on an SSD and it builds at least 60 builds a day, so my /tmp gets flooded with the temp files. Hope someone from the gradle team can share some info on this.

‘/tmp’ should get cleaned by your OS. If this isn’t the case, add a cron job that schedules ‘tmpwatch’ or similar.

It does surprise me that gradle does not clean up temporary folders once it is done with them.

Maybe a useful feature would be to add a ‘–gradle-tmpdir’ command-line option. Would work really well for CI.

Peter, is the gradle tmp dir based upon Java’s tmpdir, therefore being controllable via a ‘-D’ system property?

Typically, Gradle puts temp files into either the Java temp dir or ‘build/tmp’. It might be worthwhile to check if ‘gradle_uploadXXXSHA1’ is written by Gradle or an underlying library, and if it’s written by Gradle, use ‘Task#getTemporaryDir’ (which will go under ‘build/tmp’).

This does remind me. In unit testing code for gradle plugins one has to set the projectDir to something below ‘build/tmp’ otherwise by default it would create a directory under the OS’s temp directory.

This problem is fixed now. The fix will be in Gradle 2.2.

THank you ver much !

Thanks that was quick.

What was the fix exactly? Are files written somewhere else? Is the location configurable?

The signatures are just streamed straight to the repo. They aren’t written to a file first.