Jifeng Zhang created IVY-1472:
---------------------------------

             Summary: Failed to resolve dependency due to extra "slash" in URL
                 Key: IVY-1472
                 URL: https://issues.apache.org/jira/browse/IVY-1472
             Project: Ivy
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.4.0-RC1
         Environment: Mac OS X 10.9.2., Ivy 2.4.0-RC1, Ant 1.9.3, JDK 1.7.0_55
            Reporter: Jifeng Zhang
            Priority: Critical


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:

{code:xml}
<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>
{code}

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:

{code:xml}
<dependency org="foo" name="module1" rev="+" changing="true" conf="runtime"/>
{code}

Ivy complains 
{code}
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
{code}

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

With -debug option, I noticed that when it found revs, it output:
{code}
found revs: [0.0.1/, 0.0.2/, 0.0.3/, 0.0.4/]
{code}

When we use ivy-2.2.0, the output is:
{code}
found revs: [0.0.1, 0.0.2, 0.0.3, 0.0.4]
{code}

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:

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

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

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

Which will fail to remove the tailing slash.

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

Thanks.




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to