[GRADLE-2723] Gradle wrapper duplicates identical Gradle distributions in user home Created: 25/Mar/13 Updated: 02/Feb/17 Resolved: 02/Feb/17 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | ||
Reporter: | Gradle Forums | Assignee: | Unassigned |
Resolution: | Won't Fix | Votes: | 1 |
Description |
The Gradle Wrapper uses a hash of the distributionUrl to isolate gradle distributions downloaded from different locations. This has the unfortunate effect of creating many duplicate distributions in GRADLE_USER_HOME when the Gradle wrapper in several projects points at a Gradle distribution included in that project via SVN Externals. Gradle wrapper should really be using the hash of the downloaded distribution for isolation, not the url used to download gradle. Original report: In our team we have many projects which are using Gradle. Every project have in its root directory 'externals'.
Externals folder is shared between all projects (It's implemented using Subversion externals property, so it is same for every project). In 'externals' folder we Gradle distribution: gradle-1.4-bin.zip. Gradle wrapper is using this exact distribution. Now, when I am building projects I can see that every project is creating it's own distribution in my home: It causes big problems on CI server, as we have 7 projects using gradle. Every project is taking in CI server home about 80 MB for same files: zipped gradle distribution and its unpacked version. Currently its about 500 MB on server and will be even more if we will add another projects. Also other (human) users can use Gradle and the same problem will appear by them. My question is if it is necessary to take into consideration Gradle distribution path? If there is no essential reasons behind current behavior, I would say that this is a bug. I would be thankful for your comments and eventually solution for this problem. |
Comments |
Comment by Gradle Forums [ 25/Mar/13 ] |
The Gradle wrapper is designed to download Gradle from a known location and make it available for local use. It does this by storing the distribution in the `~/.gradle` directory. As far as I know, there's no way to prevent the Gradle wrapper from copying the distribution zip file and unzipping it. I assume that you have your Gradle Wrapper configured to 'download' the distribution from the SVN externals directory instead? |
Comment by Gradle Forums [ 25/Mar/13 ] |
Storing Gradle distribution in home directory is ok. I assume it is necessary for Gradle to work. Problem is that same distribution is copied multiple times. CI jobs are run by same user. It's not root cause of problem. I think that current Gradle behavior is like below (I didn't look at source code, though): Assumption behind above algorithm works in many cases. But in general you can not assume that different distribution location always mean different distribution. E.g. in my case different distribution paths point to same distribution. I think it would be better to make distribution resolution in 2 steps: Above algorithm should be fast and should not cause duplicated distributions, even if distribution paths are different. |
Comment by Gradle Forums [ 25/Mar/13 ] |
It seems odd that you're experiencing this behaviour. What does your `grade-wrapper.properties` file look like? Are you configuring the `distributionPath` or the `distributionUrl`? |
Comment by Gradle Forums [ 25/Mar/13 ] |
Well, it works this way. It's simple to reproduce, I have even created test case: 1. Create 3 projects in some directory: project1, project2, project3 apply plugin: 'java' 3. In every project's root directory execute: gradle wrapper I have a zipped files, but can't attach it to this thread. |
Comment by Benjamin Muschko [ 15/Nov/16 ] |
As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub. We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to. Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:
We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle! |
Comment by Benjamin Muschko [ 02/Feb/17 ] |
I don't understand the use case of wanting to host the Wrapper ZIP file in each of the projects. That defeats the purpose of the Wrapper. I am going to mark the issues as "Won't fix". |