ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Schlosnagle (JIRA)" <>
Subject [jira] Commented: (IVY-1028) Snapshot issues when using ibiblio resolver when m2compatible is false
Date Tue, 19 May 2009 01:18:45 GMT


David Schlosnagle commented on IVY-1028:

I am also encountering the {{IndexOutOfBoundsException}} triggered by {{org.apache.ivy.plugins.resolver.IBiblioResolver.findSnapshotVersion(}}
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:
--- before/ 2009-05-18 20:58:40.000000000 -0400
+++ after/  2009-05-18 20:59:32.000000000 -0400
@@ -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 pass M2_PATTERN
to the shouldUseMavenMetadata method:
--- before/ 2009-05-18 20:58:40.000000000 -0400
+++ after/  2009-05-18 21:01:25.000000000 -0400
@@ -162,8 +162,7 @@
             return null;

-        String pattern = (String) getIvyPatterns().get(0);
-        if (shouldUseMavenMetadata(pattern)) {
+        if (shouldUseMavenMetadata(M2_PATTERN)) {
             InputStream metadataStream = null;
             try {
                 String metadataLocation = IvyPatternHelper.substitute(

Example workaround ivysettings:
    <property name="M2_PATTERN" value="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"
      <chain name="chained" returnFirst="true">
        <ibiblio name="java-twitter"
          <ivy pattern="${M2_PATTERN}"/>

in ivy.xml:
  <dependency org="net.unto.twitter" name="java-twitter" rev="0.9-SNAPSHOT" conf="runtime->default"

> Snapshot issues when using ibiblio resolver when m2compatible is false
> ----------------------------------------------------------------------
>                 Key: IVY-1028
>                 URL:
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0
>            Reporter: Daniel Nielsen
>            Assignee: Maarten Coene
>             Fix For: 2.1.0-RC1
> I changed the resolver to use the maven2 of 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 "" resolver. Could you try what happens if you
add m2compatible="true" and usepoms="true" to this resolver?
> <ibiblio name="" root="${}" 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 <>
> To: "" <>
> 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}/"/>
>     <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="" root="${}"
>                  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=""/>
>         </chain>
>     </resolvers>
> </ivysettings>
> And try to fetch jsfunit snapshot with an ivy.xml file:
> <ivy-module version="2.0"
>             xmlns:xsi=""
>             xmlns:m=""
>             xsi:noNamespaceSchemaLocation="">
>     <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
> [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=
> [ivy:resolve]   maven-metadata not available:
> [ivy:resolve]           tried
> [ivy:resolve] CLIENT ERROR: Not Found url=
> [ivy:resolve]   maven-metadata not available:
> [ivy:resolve]           tried
> [ivy:resolve] CLIENT ERROR: Not Found url=
> [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
> [ivy:resolve]   jboss-snapshot: found md file for org.jboss.jsfunit#jboss-jsfunit;1.0.0.GA-SNAPSHOT
> [ivy:resolve]           =>
> [ivy:resolve] downloading
> [ivy:resolve]   jboss-snapshot: downloading
> [ivy:resolve]   jboss-snapshot: downloading
> [ivy:resolve] sha1 OK for
> [ivy:resolve]   [SUCCESSFUL ] org.jboss.jsfunit#jboss-jsfunit;1.0.0.GA-SNAPSHOT!jboss-jsfunit.pom(pom.original)
> [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:
> [ivy:resolve]           tried
> [ivy:resolve]           tried
> [ivy:resolve] CLIENT ERROR: Not Found url=
> [ivy:resolve]           tried
> [ivy:resolve] CLIENT ERROR: Not Found url=
> [ivy:resolve] CLIENT ERROR: Not Found url=
> [ivy:resolve]   maven-metadata not available:
> [ivy:resolve]           tried
> [ivy:resolve] CLIENT ERROR: Not Found url=
> [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:
> [ivy:resolve]   at java.util.ArrayList.RangeCheck(
> [ivy:resolve]   at java.util.ArrayList.get(
> [ivy:resolve]   at java.util.Collections$UnmodifiableList.get(
> [ivy:resolve]   at org.apache.ivy.plugins.resolver.IBiblioResolver.findSnapshotVersion(
> 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?

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message