1
votes

For days I have tried and simply failed to get apache ivy to resolve the dependencies of dependencies I declare in my ivy.xml, when the root dependencies are from my local repository. Root dependencies from my public repository (maven) work well, and even work when I edited one of the ivy.xml to point to a dependency on a module from my local repository. But transitive dependency resolution for my local repository will just not work. I checked the resolved ivy.xml for one of my local modules in the cache, and the dependency section had been wiped out! Is there something I have to do?

This is my ivysettings.xml file:

<ivysettings>
  <settings defaultResolver="default"/>
  <caches useOrigin="true"/>
  <include url="${ivy.default.settings.dir}/ivysettings-public.xml"/>
  <include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/>
  <include file="${ivy.default.ivy.user.dir}/settings/ivysettings-local.xml"/>
  <include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/> 
  <include url="${ivy.default.settings.dir}/ivysettings-default-chain.xml"/>
</ivysettings>

And this is my ivysettings-local.xml file:

<ivysettings>
  <property name="ivy.local.default.root"
        value="${ivy.default.ivy.user.dir}/local" override="false"/>
  <property name="ivy.local.default.ivy.pattern"
        value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/>
  <property name="ivy.local.default.artifact.pattern"
        value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/>
  <resolvers>
    <filesystem name="local">
      <artifact
        pattern="${ivy.local.default.root}/[organisation]/[module]/[revision]/[type]s/[artifact]-[revision].[ext]" />
    </filesystem>
  </resolvers>
</ivysettings>
1

1 Answers

3
votes

If you're going to create your own settings file, then let it list all your resolves (lot simpler to debug). In this case I suspect your issue is that your file system resolver is missing an "ivy" tag which might explain the missing transitive dependencies.

Try something like the following:

<ivysettings>
    <settings defaultResolver="chain"/>
    <resolvers>
        <chain name="chain">
            <ibiblio name="central" m2compatible="true"/>
            <filesystem name="local">
                <ivy pattern="${ivy.default.ivy.user.dir}/local/[organisation]/[module]/ivys/ivy-[revision].xml"/>
                <artifact pattern="${ivy.default.ivy.user.dir}/local/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
            </filesystem>
        </chain>
    </resolvers>
</ivysettings>

As you can see the chain resolver includes both Maven Central and a local repository. The following example further demonstrates how you can use a "module" directive to steer ivy towards a particular repository dependent on dependency: