By day I'm a build and release engineer in London, but by night I'm a normal person! If anyone ever asks me what I do, I usually generarlise and say "I'm in I.T." and then check to see if they've already stopped listening. When I'm not working or blogging I can be found playing rugby or cycling around the countryside on my bike, in an attempt to keep fit and fool myself into thinking I'm still young. James is a DZone MVB and is not an employee of DZone and has posted 54 posts at DZone. You can read more from them at their website. View Full User Profile

Read-only Gradle Wrapper Files Are Bad, mmkaay

  • submit to reddit

I’ve just been messing around with a Gradle build using Gradle Wrapper, trying to import an ant build which does some clever stuff. I couldn’t get it to work, so I eventually changed the Ant script to just echo a variable, and then just tried importing the ant file into gradle and calling the echo task, like this:

ant file (test.xml):

<target name=”test” >
<echo>the value of main.version is ${main.version}</echo>


Gradle file:

ant.importBuild ‘test.xml’

And I was just running this:

gradlew test


Simples, right? Well, as it happens, no. I’m running the 1.0 “release” of gradle wrapper (which is actually versioned as 1.0-rc-3, strangely enough). Whenever I tried to run my highly complicated build (ahem), I got this lovely error:

Could not open task artifact state cache (D:\development\ReleaseEngineering\main\commonBuildStuff\.gradle\1.0-rc-3\taskArtifacts).
> D:\development\ReleaseEngineering\main\commonBuildStuff\.gradle\1.0-rc-3\taskArtifacts\ (Access is denied)

Access is denied! Gah! Of course it is! Wait, why is access denied? Well, basically that file is read-only because it’s in source control and I’m using Perforce. I removed the read-only flag and the build worked. Problem temporarily solved. It’s going to be interesting to see how this is going to work in the C.I. system…

Published at DZone with permission of James Betteley, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Joern Huxhorn replied on Fri, 2012/07/13 - 4:42am

You should not put .gradle in the version control at all, only the gradle directory (without the dot) needs to be versioned. Everything in .gradle is just caching stuff and can be safely deleted and recreated.

Wujek Srujek replied on Fri, 2012/07/13 - 11:33am

You should not be using Perforce... ;d

Howard Lewis Ship replied on Fri, 2012/07/13 - 12:21pm

Really, the .gradle folder should be named .gradle.DO-NOT-CHECK-INTO-SOURCE-CODE-CONTROL-LIKE-EVERY-OTHER-DOT-DIRECTORY-EVER


He should file a bug. 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.