1. Ivy
  2. IVY-1227

UseCacheOnly doesn't respect the cache configuration in the ivysettings


    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0-RC1
    • Fix Version/s: 2.3.0-RC1
    • Component/s: Core
    • Labels:


      In my ivysettings.xml I have configured some cache which avoid having the resolver use the common .ivy2 cache. If on the resolve task I set useCacheOnly="true", then my artifacts in the cache won't be found.
      I'll attach a complete test case for the different scenario:

      1. defaultResolver="ibiblio", useCacheOnly="false", dependency on common-logging-1.1: nominal behaviour, everything works fine, artifacts get downloaded into .ivy2
      2. defaultResolver="ibiblio", useCacheOnly="true", dependency on common-logging-1.1: there is a bug in the CacheResolver, artifacts are not "downloaded", they not found. It was a missing ensuredConfigured(). I'll commit that as I am quite confident in that fix. With the fix, everything goes well.
      3. defaultResolver="chain", useCacheOnly="false", dependency on common-logging-1.2: it should be not be found in the ibiblio resolver but in the local one. Everything works fine, it get cached correctly from the local repo.
      4. defaultResolver="chain", useCacheOnly="true", dependency on common-logging-1.2: it is not found. As I was debugging it, in fact the CacheResolver isn't configured with the proper cache manager, so it uses the default one. So it looks in the wrong cache.

      My proposal as the last fix is to not use the cache resolver as a dictator resolver when we want useCacheOnly. I don't see any obvious way to make cache resolver aware of the cache it should look into, further more when there is chaining. I suggest to move this logic in the configured resolvers. I tried a very simple patch and it seems to work nicely. See the attached patch. I am not confident enough to commit it without review as it might be quite incomplete or have some side effect. At least it works with some chaining and even if there is some useOrigin=true

      1. IVY-1227-r997376.patch
        2 kB
        Nicolas Lalevée
      2. test-ivy-usecacheonly.zip
        6 kB
        Nicolas Lalevée



          • Assignee:
            Nicolas Lalevée
            Nicolas Lalevée
          • Votes:
            1 Vote for this issue
            1 Start watching this issue


            • Created: