[GRADLE-1964] Provide a mechanism for caching local filesystem dependencies when access to the filesystem is slow Created: 25/Nov/11  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Improvement
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Won't Fix Votes: 4

Issue Links:
Duplicate
Duplicated by GRADLE-2948 How can I force caching of dependenci... Resolved

 Description   

As a part of upgrading to milestone-5, we changed the way repositories are defined.
The problem we are facing with the new ivy {} repository notation is that dependencies are not being cached in the gradle cache. Repositories are currently defined as follows:

repositories {
ivy

{ artifactPattern "/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]" ivyPattern "/[organisation]/[module]/ivy-[revision].xml" }

}

On using FileSystemResolver dependency caching works fine.



 Comments   
Comment by Gradle Forums [ 25/Nov/11 ]

When a dependency artifact is available on the local filesystem, it usually doesn't make sense to copy this file into the cache. The purpose of the cache is to keep a temporary copy of any artifacts that would be expensive to re-fetch: local files usually don't meet this criteria and keeping an additional copy would be wasteful.

However, there are times when the filesystem is slow to access (eg a network share), and caching would be useful. Currently there is no mechanism for telling Gradle to cache the artifacts in these cases.

A way to instruct Gradle to cache files from a local repository is something we'd like to add. (And perhaps a way to instruct Gradle NOT to cache files from a remote repository)

Comment by Björn Kautler [ 09/Mar/12 ]

This is a major flaw in my opinion.
We have a network share as corporate repository.
There are multiple reasons why it is a bad idea not to cache those files.

  • The network may be slow sometimes or for some people that are connected via VPN always
  • The network may be down, e. g. if you travel with your laptop
  • The server is under more load than necessary
  • The network is under more load than necessary
  • ...

Please add this possibility.
My current workaround is to have a local copy of the whole repository on my disk and have the repository location configurable.

Comment by Björn Kautler [ 20/Apr/12 ]

With 1.0-rc1 using FileSystemResolver also does not cache the libraries anymore. How do I get the libraries to be cached again?

Comment by Björn Kautler [ 21/Apr/12 ]

Just for others if they have the same issue, I found a new workaround:

repositories {
   add(new org.apache.ivy.plugins.resolver.ChainResolver()) {
      add new org.apache.ivy.plugins.resolver.FileSystemResolver()
      resolvers[0].identity {
         name = 'ivy'
         addIvyPattern "$publicRepoDir/ivy/$GRADLE_IVY_PATTERN"
         addArtifactPattern "$publicRepoDir/ivy/$GRADLE_ARTIFACT_PATTERN"
         checkmodified = true
      }
   }
}
Comment by Bjarne Boström [ 07/May/15 ]

It would seem the ivy resolvers are deprecated in 2.x : https://discuss.gradle.org/t/custom-ivy-resolver-deprecation-in-gradle-2-x/7492 and the workaround posted here does not work (or maybe I failed something, I get unable to resolve class org.apache.ivy.plugins.resolver.ChainResolver). I think this feature would be important because a network shared ivyrepo is very convinient in companies.

Comment by Björn Kautler [ 13/May/15 ]

Bjarne Boström it is deprecated since some versions and is supposed to be removed in 2.x
That is mainly what prevents me from upgrading our build past 1.12.

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:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 12:09:06 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.