Out of Disk Space Error in User Home's temp directory

We have a Gradle project which has grown from a couple dozen components to over 400 java/osgi components and as a result are seeing a large increase in the amount of space being taken up in the Temp directory under user home (for example C:\Users\Bob\AppData\Local\Temp). At times the directory growing to over 20 GB after having removed the folder before running the build.

So the question is, what does Gradle store in the temp dir? Looking through it the largest files I see are several gradle.bin files which are each around 2 GB. They are always cleaned up after the build finishes, but can cause a sudden growth in disk space in the middle of the build, which can sometimes lead to a failure if the machine doesn’t have that much room available.

Has anyone else experienced this problem, or hopefully found a fix or root cause for it?


This is Gradle serialising the dependency resolution data during the build. There’s no way to avoid this at the moment.

There’s all sorts of things we could (and want to) do to make this more compact but nothing that you can just switch on as of today.

Your only real “option” is to use ‘-Djava.io.tmpdir=/somewhere/else’ to make Gradle use a disk with more space.