Ivy
  1. Ivy
  2. IVY-1028

Snapshot issues when using ibiblio resolver when m2compatible is false

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1.0-RC2
    • Component/s: Core
    • Labels:
      None

      Description

      I changed the java.net resolver to use the maven2 of download.java.net and added m2compatible and usepoms=true. Now it does not fail with NPE.

      --------------------
      I think you've found a bug in Ivy.
      It seems to be caused by your "java.net" resolver. Could you try what happens if you add m2compatible="true" and usepoms="true" to this resolver?

      <ibiblio name="java.net" root="$

      {java.net.repo}" m2compatible="true" usepoms="true"
      pattern="[organization]/jars/[module]-[revision].[ext]"/>

      If that helps, could you please open a JIRA ticket?

      Maarten




      ----- Original Message ----
      From: Daniel Nielsen <Daniel.Nielsen@blipsystems.com>
      To: "ivy-user@ant.apache.org" <ivy-user@ant.apache.org>
      Sent: Tuesday, February 3, 2009 2:41:03 PM
      Subject: Snapshot issue?!

      Hi.

      I'm currently evaluating Ivy 2.0.0 for our dependency management. I like what I've seen so far, but now I've run into trouble.

      We use JSFUnit for our testcases and we use the snapshot versions.

      To make Ivy fetch these dependencies I have the following ivy settings: (the properties file contains only version numbers and repository locations)

      <?xml version="1.0" encoding="UTF-8"?>
      <ivysettings>
      <settings defaultResolver="default"/>
      <properties file="${ivy.settings.dir}/ivysettings.properties"/>
      <caches artifactPattern="[organisation]/[module]/[type]s/[artifact][revision]([classifier]).[ext]"
      checkUpToDate="true"/>
      <resolvers>
      <filesystem name="project">
      <ivy pattern="${basedir}/lib/ivy-repo/[organisation]/[module]/ivy-[revision].xml"/>
      <artifact pattern="${basedir}/lib/ivy-repo/[organisation]/[module]/[artifact][revision]([classifier]).[ext]"/>
      </filesystem>
      <ibiblio name="central" m2compatible="true" usepoms="true" root="${central.repo}" />
      <ibiblio name="jboss" m2compatible="true" usepoms="true" root="${jboss.repo}" />
      <ibiblio name="jboss-snapshot" m2compatible="true" usepoms="true" root="${jboss.snapshotrepo}" />
      <ibiblio name="java.net" root="${java.net.repo}

      "
      pattern="[organization]/jars/[module]-[revision].[ext]"/>
      <chain name="default" returnFirst="true">
      <resolver ref="project" />
      <resolver ref="central"/>
      <resolver ref="jboss-snapshot"/>
      <resolver ref="jboss"/>
      <resolver ref="java.net"/>
      </chain>
      </resolvers>
      </ivysettings>

      And try to fetch jsfunit snapshot with an ivy.xml file:

      <ivy-module version="2.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:m="http://ant.apache.org/ivy/maven"
      xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
      <info organisation="com.blipsystems.analyzer" module="test-jsf"/>
      <configurations>
      <conf name="default" transitive="false"/>
      <conf name="jsfunit" transitive="true"/>
      </configurations>
      <dependencies defaultconf="default">

      <dependency org="org.jboss.jsfunit" name="jboss-jsfunit" rev="1.0.0.GA-SNAPSHOT" conf="jsfunit->default" />
      <!-<dependency org="org.jboss.jsfunit" name="jboss-jsfunit-core" rev="1.0.0.GA-SNAPSHOT" changing="true" conf="jsfunit>default" />-->

      <!-<dependency org="org.jboss.jsfunit" name="jboss-jsfunit-ant" rev="1.0.0.GA-SNAPSHOT" changing="true" conf="jsfunit>default" />-->
      <!-<dependency org="org.jboss.jsfunit" name="jboss-jsfunit-richfaces" rev="1.0.0.GA-SNAPSHOT" changing="true" conf="jsfunit>default" />-->
      <!-<dependency org="org.jboss.jsfunit" name="jboss-jsfunit-analysis" rev="1.0.0.GA-SNAPSHOT" changing="true" conf="jsfunit>default" />-->
      <!-- snip other dependencies for default configuration -->

      </dependencies>
      </ivy-module>

      The following is the output of a <ivy:resolve> run from ant with verbose output:

      [ivy:resolve] == resolving dependencies com.blipsystems.analyzer#test-jsf;working@danipc1->org.jboss.jsfunit#jboss-jsfunit;1.0.0.GA-SNAPSHOT [jsfunit->default] [ivy:resolve] default: Checking cache for: dependency: org.jboss.jsfunit#jboss-jsfunit;1.0.0.GA-SNAPSHOT

      {jsfunit=[default]}
      [ivy:resolve] tried c:\Users\dani.BSH\work\analyzer-trunk/lib/ivy-repo/org.jboss.jsfunit/jboss-jsfunit/ivy-1.0.0.GA-SNAPSHOT.xml
      [ivy:resolve] tried c:\Users\dani.BSH\work\analyzer-trunk/lib/ivy-repo/org.jboss.jsfunit/jboss-jsfunit/jboss-jsfunit-1.0.0.GA-SNAPSHOT.jar
      [ivy:resolve] project: no ivy file nor artifact found for org.jboss.jsfunit#jboss-jsfunit;1.0.0.GA-SNAPSHOT
      [ivy:resolve] don't use cache for org.jboss.jsfunit#jboss-jsfunit;1.0.0.GA-SNAPSHOT: changing=true [ivy:resolve] CLIENT ERROR: Not Found url=http://repo1.maven.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/maven-metadata.xml
      [ivy:resolve] maven-metadata not available: http://repo1.maven.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/maven-metadata.xml
      [ivy:resolve] tried http://repo1.maven.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-SNAPSHOT.pom
      [ivy:resolve] CLIENT ERROR: Not Found url=http://repo1.maven.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-SNAPSHOT.pom
      [ivy:resolve] maven-metadata not available: http://repo1.maven.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/maven-metadata.xml
      [ivy:resolve] tried http://repo1.maven.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-SNAPSHOT.jar
      [ivy:resolve] CLIENT ERROR: Not Found url=http://repo1.maven.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-SNAPSHOT.jar
      [ivy:resolve] central: no ivy file nor artifact found for org.jboss.jsfunit#jboss-jsfunit;1.0.0.GA-SNAPSHOT
      [ivy:resolve] don't use cache for org.jboss.jsfunit#jboss-jsfunit;1.0.0.GA-SNAPSHOT: changing=true [ivy:resolve] [1.0.0.GA-20090129.125050-9] org/jboss/jsfunit#jboss-jsfunit;1.0.0.GA-SNAPSHOT
      [ivy:resolve] tried http://snapshots.jboss.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-20090129.125050-9.pom
      [ivy:resolve] jboss-snapshot: found md file for org.jboss.jsfunit#jboss-jsfunit;1.0.0.GA-SNAPSHOT
      [ivy:resolve] => http://snapshots.jboss.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-20090129.125050-9.pom (1.0.0.GA-SNAPSHOT)
      [ivy:resolve] downloading http://snapshots.jboss.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-20090129.125050-9.pom ...
      [ivy:resolve] jboss-snapshot: downloading http://snapshots.jboss.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-20090129.125050-9.pom
      [ivy:resolve] jboss-snapshot: downloading http://snapshots.jboss.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-20090129.125050-9.pom.sha1
      [ivy:resolve] sha1 OK for http://snapshots.jboss.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-20090129.125050-9.pom
      [ivy:resolve] [SUCCESSFUL ] org.jboss.jsfunit#jboss-jsfunit;1.0.0.GA-SNAPSHOT!jboss-jsfunit.pom(pom.original) (869ms)
      [ivy:resolve] default: Checking cache for: dependency: org.jboss#jboss-parent;3 {} [ivy:resolve] default: module revision found in cache: org.jboss#jboss-parent;3
      [ivy:resolve] tried c:\Users\dani.BSH\work\analyzer-trunk/lib/ivy-repo/org.jboss.jsfunit/jboss-jsfunit/jboss-jsfunit-1.0.0.GA-SNAPSHOT.jar
      [ivy:resolve] maven-metadata not available: http://repo1.maven.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/maven-metadata.xml
      [ivy:resolve] tried http://repo1.maven.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-SNAPSHOT.jar
      [ivy:resolve] tried http://snapshots.jboss.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-20090129.125050-9.jar
      [ivy:resolve] CLIENT ERROR: Not Found url=http://snapshots.jboss.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-20090129.125050-9.jar
      [ivy:resolve] tried http://snapshots.jboss.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-SNAPSHOT.jar
      [ivy:resolve] CLIENT ERROR: Not Found url=http://snapshots.jboss.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-SNAPSHOT.jar
      [ivy:resolve] CLIENT ERROR: Not Found url=http://repository.jboss.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/maven-metadata.xml
      [ivy:resolve] maven-metadata not available: http://repository.jboss.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/maven-metadata.xml
      [ivy:resolve] tried http://repository.jboss.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-SNAPSHOT.jar
      [ivy:resolve] CLIENT ERROR: Not Found url=http://repository.jboss.org/maven2/org/jboss/jsfunit/jboss-jsfunit/1.0.0.GA-SNAPSHOT/jboss-jsfunit-1.0.0.GA-SNAPSHOT.jar
      [ivy:resolve] problem occured while resolving dependency: org.jboss.jsfunit#jboss-jsfunit;1.0.0.GA-SNAPSHOT {jsfunit=[default]}

      with jboss-snapshot: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
      [ivy:resolve] at java.util.ArrayList.RangeCheck(ArrayList.java:547)
      [ivy:resolve] at java.util.ArrayList.get(ArrayList.java:322)
      [ivy:resolve] at java.util.Collections$UnmodifiableList.get(Collections.java:1154)
      [ivy:resolve] at org.apache.ivy.plugins.resolver.IBiblioResolver.findSnapshotVersion(IBiblioResolver.java:161)

      The jboss-jsfunit is a pom declaring only dependencies with no jars, but Ivy apparently expects an jar to download? Ivy identifies the correct snapshot version, but I don't get why it tries to download the jboss-jsfunit jar.

      I've tried listing the stuff I need from jsfunit (jboss-jsfunit-core etc) but these poms have a <parent> attribute naming jboss-jsfunit and ivy resolves this parent regardless of transitive settings.

      Am I doing something wrong or is this a bug in Ivy?

      1. IVY-1028-3.patch
        0.6 kB
        David Schlosnagle
      2. IVY-1028-1.patch
        0.6 kB
        David Schlosnagle

        Activity

        Hide
        Maarten Coene added a comment -

        Should be fixed in SVN trunk.
        Could you give it a try?

        Show
        Maarten Coene added a comment - Should be fixed in SVN trunk. Could you give it a try?
        Hide
        Daniel Nielsen added a comment - - edited

        I just retried this with 2.1.0-rc1, and it still fails. This time with a IndexOutOfBoundsException from the jboss-nopoms resolver:

        java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        [ivy:resolve] at java.util.ArrayList.RangeCheck(ArrayList.java:547)
        [ivy:resolve] at java.util.ArrayList.get(ArrayList.java:322)
        [ivy:resolve] at java.util.Collections$UnmodifiableList.get(Collections.java:1154)
        [ivy:resolve] at org.apache.ivy.plugins.resolver.IBiblioResolver.findSnapshotVersion(IBiblioResolver.java:165)
        [ivy:resolve] at org.apache.ivy.plugins.resolver.IBiblioResolver.findSnapshotArtifact(IBiblioResolver.java:130)
        [ivy:resolve] at org.apache.ivy.plugins.resolver.IBiblioResolver.findArtifactRef(IBiblioResolver.java:119)
        [ivy:resolve] at org.apache.ivy.plugins.resolver.BasicResolver.getArtifactRef(BasicResolver.java:924)
        [ivy:resolve] at org.apache.ivy.plugins.resolver.BasicResolver.findFirstArtifactRef(BasicResolver.java:861)
        [ivy:resolve] at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:235)
        [ivy:resolve] at org.apache.ivy.plugins.resolver.IBiblioResolver.getDependency(IBiblioResolver.java:508)
        [ivy:resolve] at org.apache.ivy.plugins.resolver.ChainResolver.getDependency(ChainResolver.java:130)
        [ivy:resolve] at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseOtherPom(PomModuleDescriptorParser.java:316)
        [ivy:resolve] at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:134)
        [ivy:resolve] at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:105)
        [ivy:resolve] at org.apache.ivy.core.cache.DefaultRepositoryCacheManager$MyModuleDescriptorProvider.provideModule(DefaultRepositoryCacheManager.java:637)
        [ivy:resolve] at org.apache.ivy.core.cache.ModuleDescriptorMemoryCache.getStale(ModuleDescriptorMemoryCache.java:68)
        [ivy:resolve] at org.apache.ivy.core.cache.DefaultRepositoryCacheManager.getStaledMd(DefaultRepositoryCacheManager.java:654)
        [ivy:resolve] at org.apache.ivy.core.cache.DefaultRepositoryCacheManager.cacheModuleDescriptor(DefaultRepositoryCacheManager.java:940)
        [ivy:resolve] at org.apache.ivy.plugins.resolver.BasicResolver.parse(BasicResolver.java:542)
        [ivy:resolve] at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:263)
        [ivy:resolve] at org.apache.ivy.plugins.resolver.IBiblioResolver.getDependency(IBiblioResolver.java:508)
        [ivy:resolve] at org.apache.ivy.plugins.resolver.ChainResolver.getDependency(ChainResolver.java:130)
        [ivy:resolve] at org.apache.ivy.core.resolve.IvyNode.loadData(IvyNode.java:169)
        [ivy:resolve] at org.apache.ivy.core.resolve.VisitNode.loadData(VisitNode.java:272)
        [ivy:resolve] at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:671)
        [ivy:resolve] at org.apache.ivy.core.resolve.ResolveEngine.doFetchDependencies(ResolveEngine.java:757)
        [ivy:resolve] at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:679)
        [ivy:resolve] at org.apache.ivy.core.resolve.ResolveEngine.getDependencies(ResolveEngine.java:551)
        [ivy:resolve] at org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:235)
        [ivy:resolve] at org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:193)
        [ivy:resolve] at org.apache.ivy.Ivy.resolve(Ivy.java:502)
        [ivy:resolve] at org.apache.ivy.ant.IvyResolve.doExecute(IvyResolve.java:244)
        [ivy:resolve] at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277)

        [snip ant trace]

        My ivy.settings.xml looks like:

        <?xml version="1.0" encoding="UTF-8"?>
        <ivysettings>
        <settings defaultResolver="default"/>
        <properties file="$

        {ivy.settings.dir}

        /ivysettings.properties"/>
        <caches artifactPattern="[organisation]/[module]/[type]s/[artifact][revision]([classifier]).[ext]"
        checkUpToDate="true"/>
        <resolvers>
        <filesystem name="project">
        <ivy pattern="$

        {basedir}/lib/ivy-repo/[organisation]/[module]/ivy-[revision].xml"/>
        <artifact pattern="${basedir}

        /lib/ivy-repo/[organisation]/[module]/[artifact][revision]([classifier]).[ext]"/>
        </filesystem>
        <ibiblio name="central" m2compatible="true" usepoms="true" root="$

        {central.repo}

        " />
        <ibiblio name="jboss" m2compatible="true" usepoms="true" root="$

        {jboss.repo}" />
        <ibiblio name="jboss-snapshot" m2compatible="true" usepoms="true" root="${jboss.snapshotrepo}" />
        <ibiblio name="java.net" root="${java.net.repo}" m2compatible="true" usepoms="true" />
        <ibiblio name="jboss-nopoms" m2compatible="true" usepoms="false" root="${jboss.repo}

        "
        pattern="[organisation]/[module]/[revision]/[artifact][revision]([classifier]).[ext]"/>
        <chain name="default" returnFirst="true">
        <resolver ref="project" />
        <resolver ref="central"/>
        <resolver ref="jboss-snapshot"/>
        <resolver ref="jboss"/>
        <resolver ref="java.net"/>
        <resolver ref="jboss-nopoms" />
        </chain>
        </resolvers>
        </ivysettings>

        If I remove the resolver jboss-nopoms, all is well. I use jboss nopoms to work around some bad metadata in a POM file for a library I need.

        Show
        Daniel Nielsen added a comment - - edited I just retried this with 2.1.0-rc1, and it still fails. This time with a IndexOutOfBoundsException from the jboss-nopoms resolver: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 [ivy:resolve] at java.util.ArrayList.RangeCheck(ArrayList.java:547) [ivy:resolve] at java.util.ArrayList.get(ArrayList.java:322) [ivy:resolve] at java.util.Collections$UnmodifiableList.get(Collections.java:1154) [ivy:resolve] at org.apache.ivy.plugins.resolver.IBiblioResolver.findSnapshotVersion(IBiblioResolver.java:165) [ivy:resolve] at org.apache.ivy.plugins.resolver.IBiblioResolver.findSnapshotArtifact(IBiblioResolver.java:130) [ivy:resolve] at org.apache.ivy.plugins.resolver.IBiblioResolver.findArtifactRef(IBiblioResolver.java:119) [ivy:resolve] at org.apache.ivy.plugins.resolver.BasicResolver.getArtifactRef(BasicResolver.java:924) [ivy:resolve] at org.apache.ivy.plugins.resolver.BasicResolver.findFirstArtifactRef(BasicResolver.java:861) [ivy:resolve] at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:235) [ivy:resolve] at org.apache.ivy.plugins.resolver.IBiblioResolver.getDependency(IBiblioResolver.java:508) [ivy:resolve] at org.apache.ivy.plugins.resolver.ChainResolver.getDependency(ChainResolver.java:130) [ivy:resolve] at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseOtherPom(PomModuleDescriptorParser.java:316) [ivy:resolve] at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:134) [ivy:resolve] at org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:105) [ivy:resolve] at org.apache.ivy.core.cache.DefaultRepositoryCacheManager$MyModuleDescriptorProvider.provideModule(DefaultRepositoryCacheManager.java:637) [ivy:resolve] at org.apache.ivy.core.cache.ModuleDescriptorMemoryCache.getStale(ModuleDescriptorMemoryCache.java:68) [ivy:resolve] at org.apache.ivy.core.cache.DefaultRepositoryCacheManager.getStaledMd(DefaultRepositoryCacheManager.java:654) [ivy:resolve] at org.apache.ivy.core.cache.DefaultRepositoryCacheManager.cacheModuleDescriptor(DefaultRepositoryCacheManager.java:940) [ivy:resolve] at org.apache.ivy.plugins.resolver.BasicResolver.parse(BasicResolver.java:542) [ivy:resolve] at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:263) [ivy:resolve] at org.apache.ivy.plugins.resolver.IBiblioResolver.getDependency(IBiblioResolver.java:508) [ivy:resolve] at org.apache.ivy.plugins.resolver.ChainResolver.getDependency(ChainResolver.java:130) [ivy:resolve] at org.apache.ivy.core.resolve.IvyNode.loadData(IvyNode.java:169) [ivy:resolve] at org.apache.ivy.core.resolve.VisitNode.loadData(VisitNode.java:272) [ivy:resolve] at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:671) [ivy:resolve] at org.apache.ivy.core.resolve.ResolveEngine.doFetchDependencies(ResolveEngine.java:757) [ivy:resolve] at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:679) [ivy:resolve] at org.apache.ivy.core.resolve.ResolveEngine.getDependencies(ResolveEngine.java:551) [ivy:resolve] at org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:235) [ivy:resolve] at org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:193) [ivy:resolve] at org.apache.ivy.Ivy.resolve(Ivy.java:502) [ivy:resolve] at org.apache.ivy.ant.IvyResolve.doExecute(IvyResolve.java:244) [ivy:resolve] at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277) [snip ant trace] My ivy.settings.xml looks like: <?xml version="1.0" encoding="UTF-8"?> <ivysettings> <settings defaultResolver="default"/> <properties file="$ {ivy.settings.dir} /ivysettings.properties"/> <caches artifactPattern=" [organisation] / [module] / [type] s/ [artifact] [revision] ( [classifier] ). [ext] " checkUpToDate="true"/> <resolvers> <filesystem name="project"> <ivy pattern="$ {basedir}/lib/ivy-repo/ [organisation] / [module] /ivy- [revision] .xml"/> <artifact pattern="${basedir} /lib/ivy-repo/ [organisation] / [module] / [artifact] [revision] ( [classifier] ). [ext] "/> </filesystem> <ibiblio name="central" m2compatible="true" usepoms="true" root="$ {central.repo} " /> <ibiblio name="jboss" m2compatible="true" usepoms="true" root="$ {jboss.repo}" /> <ibiblio name="jboss-snapshot" m2compatible="true" usepoms="true" root="${jboss.snapshotrepo}" /> <ibiblio name="java.net" root="${java.net.repo}" m2compatible="true" usepoms="true" /> <ibiblio name="jboss-nopoms" m2compatible="true" usepoms="false" root="${jboss.repo} " pattern=" [organisation] / [module] / [revision] / [artifact] [revision] ( [classifier] ). [ext] "/> <chain name="default" returnFirst="true"> <resolver ref="project" /> <resolver ref="central"/> <resolver ref="jboss-snapshot"/> <resolver ref="jboss"/> <resolver ref="java.net"/> <resolver ref="jboss-nopoms" /> </chain> </resolvers> </ivysettings> If I remove the resolver jboss-nopoms, all is well. I use jboss nopoms to work around some bad metadata in a POM file for a library I need.
        Hide
        David Schlosnagle added a comment - - edited

        I am also encountering the IndexOutOfBoundsException triggered by org.apache.ivy.plugins.resolver.IBiblioResolver.findSnapshotVersion(IBiblioResolver.java:165) using Apache Ivy 2.1.0-rc1. The problem appears to only occur when using the Ibiblio resolver when no ivy patterns have been defined for that resolver. It is therefore possible to workaround the bug by adding the following element within the Ibiblio resolver(s) that use snapshot versions.

          <ivy pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
        

        The root of the problem is the following line of code:

          String pattern = (String) getIvyPatterns().get(0);
        

        I'd naively suggest the following as a fix to default the M2_PATTERN if none is defined for the resolver as this will cause org.apache.ivy.plugins.resolver.IBiblioResolver.shouldUseMavenMetadata(String) to return true if the resolver is configured to use maven metadata and is M2 compatible since the default pattern would always end with the M2_PATTERN:

            String pattern = (String) (getIvyPatterns().isEmpty() ? M2_PATTERN : getIvyPatterns().get(0));
        

        Unified diff:

        Index: src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
        ===================================================================
        --- src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java       (revision 776148)
        +++ src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java       (working copy)
        @@ -162,7 +162,7 @@
                     return null;
                 }
        
        -        String pattern = (String) getIvyPatterns().get(0);
        +        String pattern = (String) (getIvyPatterns().isEmpty() ? M2_PATTERN : getIvyPatterns().get(0));
                 if (shouldUseMavenMetadata(pattern)) {
                     InputStream metadataStream = null;
                     try {
        

        I don't know enough about when it would make sense to define an ivy pattern for an Ibiblio resolver, but if the ivy pattern is not needed it would be simple enough to just use the isUseMavenMetadata() method:

        Index: src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
        ===================================================================
        --- src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java       (revision 776148)
        +++ src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java       (working copy)
        @@ -162,8 +162,7 @@
                     return null;
                 }
                 
        -        String pattern = (String) getIvyPatterns().get(0);
        -        if (shouldUseMavenMetadata(pattern)) {
        +        if (isUseMavenMetadata()) {
                     InputStream metadataStream = null;
                     try {
                         String metadataLocation = IvyPatternHelper.substitute(
        

        Example workaround ivysettings:

          <ivysettings>
            <property name="M2_PATTERN" value="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" override="false"/>
            <resolvers>
              <chain name="chained" returnFirst="true">
                <ibiblio name="java-twitter"
                  root="http://java-twitter.googlecode.com/svn/repository/"
                  pattern="[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]"
                  m2compatible="true"
                  usepoms="false">
                  <ivy pattern="${M2_PATTERN}"/>
                </ibiblio>
              </chain>
            </resolvers>
          </ivysettings>
        

        in ivy.xml:

          <dependency org="net.unto.twitter" name="java-twitter" rev="0.9-SNAPSHOT" conf="runtime->default" />
        
        Show
        David Schlosnagle added a comment - - edited I am also encountering the IndexOutOfBoundsException triggered by org.apache.ivy.plugins.resolver.IBiblioResolver.findSnapshotVersion(IBiblioResolver.java:165) using Apache Ivy 2.1.0-rc1. The problem appears to only occur when using the Ibiblio resolver when no ivy patterns have been defined for that resolver. It is therefore possible to workaround the bug by adding the following element within the Ibiblio resolver(s) that use snapshot versions. <ivy pattern= "[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" /> The root of the problem is the following line of code: String pattern = ( String ) getIvyPatterns().get(0); I'd naively suggest the following as a fix to default the M2_PATTERN if none is defined for the resolver as this will cause org.apache.ivy.plugins.resolver.IBiblioResolver.shouldUseMavenMetadata(String) to return true if the resolver is configured to use maven metadata and is M2 compatible since the default pattern would always end with the M2_PATTERN: String pattern = ( String ) (getIvyPatterns().isEmpty() ? M2_PATTERN : getIvyPatterns().get(0)); Unified diff: Index: src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java =================================================================== --- src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java (revision 776148) +++ src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java (working copy) @@ -162,7 +162,7 @@ return null ; } - String pattern = ( String ) getIvyPatterns().get(0); + String pattern = ( String ) (getIvyPatterns().isEmpty() ? M2_PATTERN : getIvyPatterns().get(0)); if (shouldUseMavenMetadata(pattern)) { InputStream metadataStream = null ; try { I don't know enough about when it would make sense to define an ivy pattern for an Ibiblio resolver, but if the ivy pattern is not needed it would be simple enough to just use the isUseMavenMetadata() method: Index: src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java =================================================================== --- src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java (revision 776148) +++ src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java (working copy) @@ -162,8 +162,7 @@ return null ; } - String pattern = ( String ) getIvyPatterns().get(0); - if (shouldUseMavenMetadata(pattern)) { + if (isUseMavenMetadata()) { InputStream metadataStream = null ; try { String metadataLocation = IvyPatternHelper.substitute( Example workaround ivysettings: <ivysettings> <property name= "M2_PATTERN" value= "[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" override= "false" /> <resolvers> <chain name= "chained" returnFirst= "true" > <ibiblio name= "java-twitter" root= "http://java-twitter.googlecode.com/svn/repository/" pattern= "[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]" m2compatible= "true" usepoms= "false" > <ivy pattern= "${M2_PATTERN}" /> </ibiblio> </chain> </resolvers> </ivysettings> in ivy.xml: <dependency org= "net.unto.twitter" name= "java-twitter" rev= "0.9-SNAPSHOT" conf= "runtime-> default" />
        Hide
        David Schlosnagle added a comment -

        Alternate fixes for this issue, see my earlier comments for explanations

        Show
        David Schlosnagle added a comment - Alternate fixes for this issue, see my earlier comments for explanations
        Hide
        Maarten Coene added a comment -

        I've committed a possible fix to SVN trunk.
        Could you give it a try?

        Show
        Maarten Coene added a comment - I've committed a possible fix to SVN trunk. Could you give it a try?

          People

          • Assignee:
            Maarten Coene
            Reporter:
            Daniel Nielsen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development