Using the Gradle user home directory for storing plugin specific files


I’m working on the GradleFx plugin and I’d like to store some files (like the flash player, Flex SDK) in the Gradle user home folder (in “Documents and Settings/.gradle/gradlefx”)

Now I’ve got two questions: 1. Is this the recommended way for a plugin to store some files or should it create its own directory next to “.gradle”? 2. How can I get the location of this gradle user home folder?

Thanks :slight_smile:

any thoughts on this?

What kind of files? How about storing them somewhere below the root project’s directory? You can get the path to the Gradle user home directory with ‘project.gradle.gradleUserHomeDir’. See the DSL reference.

One case for which I’d like to use it would be for the Flex SDK. I want to automatically download the Flex SDK zip as a url dependency (see and then I would unpack the zip file to a specific directory from which my plugin can access it. Another case would be for the Flash Player executable, which I also want to automatically download and store it in such a directory.

Somewhere below the root project’s directory could be another good solution, saves me the effort of creating version directories for each unpacked sdk. Only downside could be that it takes up quite some space if you have multiple Flex projects since the Flex SDK is about 230MB. So if you have 5 Flex projects with a different root project, all with the same version of the Flex SDK, then it would use up 1.25GB.

I’d make it configurable, and use something like ~/flex-sdk-$version as the default. Before downloading, I’d check if the directory already exists.

ok, sounds like a good idea, thanks for the advice :slight_smile: