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

Failed to resolve dependency due to extra "slash" in URL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.4.0-RC1
    • 2.4.0
    • Core
    • None
    • Mac OS X 10.9.2., Ivy 2.4.0-RC1, Ant 1.9.3, JDK 1.7.0_55

    Description

      We have a self build ivy repo (basically a http server serving files, not maven 2 compatible) for storing in house built libraries and all 3rd party libs, this is how our resolver looks like:

      <ivysettings>
          <settings defaultResolver="default" />
          <caches defaultCacheDir="${basedir}/ivy-cache" />
          <resolvers>
              <url name="internal">
                  <ivy pattern="http://dev/repo/[org]/[module]/[module]-[revision]/ivy-[revision].xml" />
                  <artifact pattern="http://dev/repo/[org]/[module]/[module]-[revision]/[artifact]-[revision].[ext]" />
              </url>
              <chain name="default">
                  <resolver ref="internal"/>
              </chain>
          </resolvers>
      </ivysettings>
      

      We have been using ivy 2.2.0 for some time and everything works. Recently we tried to use ivy 2.4.0-RC1, suddenly we can not resolve the libraries using the version matcher, for example:

      <dependency org="foo" name="module1" rev="+" changing="true" conf="runtime"/>
      

      Ivy complains

      CLIENT ERROR: Not Found url=http://dev/repo/foo/module1/module1-0.0.1/ivy-0.0.1/.xml
      CLIENT ERROR: Not Found url=http://dev/repo/foo/module1/module1-0.0.2/ivy-0.0.2/.xml
      CLIENT ERROR: Not Found url=http://dev/repo/foo/module1/module1-0.0.3/ivy-0.0.3/.xml
      CLIENT ERROR: Not Found url=http://dev/repo/foo/module1/module1-0.0.4/ivy-0.0.4/.xml
      

      You can notice that there is an extra "/" after the version number, before the .xml extension.

      With -verbose option, I noticed that when it found revs, it output:

      found revs: [0.0.1/, 0.0.2/, 0.0.3/, 0.0.4/]
      

      When we use ivy-2.2.0, the output is:

      found revs: [0.0.1, 0.0.2, 0.0.3, 0.0.4]
      

      Further digging into source code of Ivy,

      In version 2.2.0, org.apache.ivy.plugins.resolver.util.ResolverHelper, line 76 uses following pattern to match and remove the tailing slash:

      String acceptNamePattern = ".*?"+ IvyPatternHelper.substituteToken(namePattern, token, "([^" + fileSep+ "]+)") + "($|" + fileSep + ".*)";
      

      But in 2.4.0-RC1, line 76 , that code has been changed to:

      namePattern = IvyPatternHelper.substituteToken(namePattern, token, "(.+)");
      

      Which will fail to remove the tailing slash.

      Is this a bug or what is the background of changing the regex?

      Thanks.

      Attachments

        1. IVY-1472.zip
          1.94 MB
          Jifeng Zhang
        2. IVY-1472.patch
          0.9 kB
          Jifeng Zhang

        Activity

          People

            maartenc Maarten Coene
            jifeng.zhang Jifeng Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: