views:

275

answers:

1

For some reason I can't seem to resolve the dependencies of my dependencies when using a url resolver to specify a repository's location. However, when using the ibiblio resolver, I am able to retrieve them.

For example:

<!-- Ivy File -->
<ivy-module version="1.0">
<info organisation="org.apache" module="chained-resolvers"/>
<dependencies>
    <dependency org="commons-lang" name="commons-lang" rev="2.0" conf="default"/>
    <dependency org="checkstyle" name="checkstyle" rev="5.0"/>
</dependencies>
</ivy-module>


<!-- ivysettings file -->
<ivysettings>
<settings defaultResolver="chained"/>
  <resolvers>
    <chain name="chained">
      <url name="custom-repo">
        <ivy pattern="http://my.internal.domain.name/ivy/[organisation]/[module]/[revision]/ivy-[revision].xml"/&gt;
        <artifact pattern="http://my.internal.domain.name/ivy/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/&gt;
      </url>
      <url name="ibiblio-mirror" m2compatible="true">
        <artifact pattern="http://mirrors.ibiblio.org/pub/mirrors/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
      </url>
      <ibiblio name="ibiblio" m2compatible="true"/>
    </chain>
  </resolvers>
</ivysettings>


<!-- checkstyle ivy.xml file generated from pom via ivy:install task -->
    <?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="1.0" xmlns:m="http://ant.apache.org/ivy/maven"&gt;
    <info organisation="checkstyle"
        module="checkstyle"
        revision="5.0"
        status="release"
        publication="20090509202448"
        namespace="maven2"
    >
        <license name="GNU Lesser General Public License" url="http://www.gnu.org/licenses/lgpl.txt" />
        <description homepage="http://checkstyle.sourceforge.net/"&gt;
        Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard
        </description>
    </info>
    <configurations>
        <conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
        <conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
        <conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
        <conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
        <conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/>
        <conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." extends="runtime"/>
        <conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/>
        <conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
        <conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
        <conf name="optional" visibility="public" description="contains all optional dependencies"/>
    </configurations>
    <publications>
        <artifact name="checkstyle" type="jar" ext="jar" conf="master"/>
    </publications>
    <dependencies>
        <dependency org="antlr" name="antlr" rev="2.7.6" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
        <dependency org="apache" name="commons-beanutils-core" rev="1.7.0" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
        <dependency org="apache" name="commons-cli" rev="1.0" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
        <dependency org="apache" name="commons-logging" rev="1.0.3" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
        <dependency org="com.google.collections" name="google-collections" rev="0.9" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
    </dependencies>
</ivy-module>

Using the "ibiblio" resolver I have no problem resolving my project's two dependencies (commons-lang 2.0 and checkstyle 5.0) and checkstyle's dependencies. However, when attempting to exclusively use the "custom-repo" or "ibiblio-mirror" resolvers, I am able to resolve my project's two explicitly defined dependencies, but not checkstyle's dependencies.

Is this possible? Any help would be greatly appreciated.

A: 

The reason is you didn't specify an ivy pattern for your 'ibibio-mirror' resolver. Your mirror should look somthing like (don't forget the [classifier] token):

  <url name="ibiblio-mirror" m2compatible="true">
    <ivy pattern="http://mirrors.ibiblio.org/pub/mirrors/maven2/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" />
    <artifact pattern="http://mirrors.ibiblio.org/pub/mirrors/maven2/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" />
  </url>

But you could also use the ibiblio resolver for your mirror:

  <ibiblio name="ibiblio-mirror" root="http://mirrors.ibiblio.org/pub/mirrors/maven2/" m2compatible="true"/>

Maarten

Maarten Coene
Maarten, thank you for your response, but your first solution doesn't seem to work as only the two dependencies I listed in my ivy.xml are being resolved.However, using the ibiblio resolver with a custom root partially worked. I say partially because when I specify a new pattern layout in the pattern attribute, Ivy seems to ignore it and continues to use its default pattern. Any ideas?Here is the resolver I am trying:<ibiblio name="ibiblio" root="http://my.internal.domain.name/ivy/" pattern="[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" m2compatible="true"/>
Sean
Regarding the problem with your custom ibiblio pattern, could you try again with Ivy trunk version? You might hit the issue reported here: https://issues.apache.org/jira/browse/IVY-1124.
Maarten Coene