Uploaded image for project: 'Ivy'
  1. Ivy
  2. IVY-59

Error retrieving dependencies with a '+' in their revision if the ivy file doesn't exist

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.2
    • Component/s: Core
    • Labels:
      None

      Description

      Hi,

      I receive an error with ivy if I try to retrieve a dependency when the following is true:

      • there is a '+' in the revision
      • the dependency hasn't been downloaded to the cache yet
      • there is no ivy file for that dependency in the repository (which is a local file repository)

      The exception I receive is (I've filtered out some compony-specific information):
      WARN: problem while downloading ivy file: c:\working\ivy-repository\...\lib\ivy-3.0.1.xml: c:\working\ivy-repository\...\lib\ivy-3.0.1.xml (The system cannot find the file specified)
      [resolve] java.io.FileNotFoundException: c:\working\ivy-repository\...\lib\ivy-3.0.1.xml (The system cannot find the file specified)
      [resolve] at java.io.FileInputStream.open(Native Method)
      [resolve] at java.io.FileInputStream.<init>(FileInputStream.java:106)
      [resolve] at fr.jayasoft.ivy.util.FileUtil.copy(FileUtil.java:28)
      [resolve] at fr.jayasoft.ivy.repository.file.FileRepository.copy(FileRepository.java:59)
      [resolve] at fr.jayasoft.ivy.repository.file.FileRepository.get(FileRepository.java:49)
      [resolve] at fr.jayasoft.ivy.resolver.RepositoryResolver.get(RepositoryResolver.java:112)
      [resolve] at fr.jayasoft.ivy.resolver.BasicResolver.getDependency(BasicResolver.java:237)
      [resolve] at fr.jayasoft.ivy.resolver.ChainResolver.getDependency(ChainResolver.java:45)
      [resolve] at fr.jayasoft.ivy.IvyNode.loadData(IvyNode.java:435)
      [resolve] at fr.jayasoft.ivy.Ivy.fetchDependencies(Ivy.java:736)
      [resolve] at fr.jayasoft.ivy.Ivy.doFetchDependencies(Ivy.java:786)
      [resolve] at fr.jayasoft.ivy.Ivy.fetchDependencies(Ivy.java:746)
      [resolve] at fr.jayasoft.ivy.Ivy.getDependencies(Ivy.java:714)
      [resolve] at fr.jayasoft.ivy.Ivy.resolve(Ivy.java:585)
      [resolve] at fr.jayasoft.ivy.ant.IvyResolve.execute(IvyResolve.java:84)
      [resolve] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
      [resolve] at org.apache.tools.ant.Task.perform(Task.java:364)
      [resolve] at org.apache.tools.ant.Target.execute(Target.java:301)
      [resolve] at org.apache.tools.ant.Target.performTasks(Target.java:328)
      [resolve] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
      [resolve] at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
      [resolve] at org.apache.tools.ant.Main.runBuild(Main.java:632)
      [resolve] at org.apache.tools.ant.Main.startAnt(Main.java:183)
      [resolve] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
      [resolve] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
      WARN: module not found: home/commons-3+

      I've fixed it by modifying the RepositoryResolver.findResourceUsingPattern(...) method:
      (I should have attached a patch file, but I don't have the right tools here at work to create such a patch, sorry...)

      public static ResolvedResource findResourceUsingPattern(String name, Repository repository, LatestStrategy strategy, ModuleRevisionId mrid, String pattern, String artifact, String type, String ext, Date date) {
      String resourceName = IvyPatternHelper.substitute(pattern, mrid, artifact, type, ext);
      Message.debug("\t trying "+resourceName);
      try {
      Resource res = repository.getResource(resourceName);
      long start = System.currentTimeMillis();
      boolean reachable = res.exists();
      if (reachable)

      { return new ResolvedResource(res, mrid.getRevision()); }

      else if (!mrid.isExactRevision()) {
      ResolvedResource[] rress = ResolverHelper.findAll(repository, mrid, pattern, artifact, type, ext);
      if (rress == null)

      { Message.debug("\t"+name+": unable to list resources for "+mrid+": pattern="+pattern); return null; }

      else {
      for (int i = 0; i < rress.length; i++)

      { Message.debug("\t"+name+": found "+rress[i]); }

      }
      ResolvedResource found = (ResolvedResource)strategy.findLatest(rress, date);
      if (found == null)

      { Message.debug("\t"+name+": no resource found for "+mrid+": pattern="+pattern); // START CHANGE }

      else if (!found.getResource().exists())

      { Message.debug("\t"+name+": resource not reachable for "+mrid+": res="+res); return null; }

      // STOP CHANGE

      return found;
      } else

      { Message.debug("\t"+name+": resource not reachable for "+mrid+": res="+res); return null; }

      } catch (Exception ex)

      { Message.debug("\t"+name+": unable to get resource for "+mrid+": res="+resourceName+": "+ex.getMessage()); return null; }

      }

      regards,
      Maarten

        Attachments

          Activity

            People

            • Assignee:
              xavier Xavier Hanin
              Reporter:
              maartenc Maarten Coene
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: