Andrea
Andrea

Reputation: 446

correct configurations for ivy transitive dependencies

My project is composed of n modules. One of these, let's say it is called my-first-module declares, amongst others, one dependency like:

<dependency org="com.mycompany.myproject" name="my-second-module" conf="default->default" rev="1.0-SNAPSHOT"/>

The artifacts are stored in an internal repository which is correctly working when retrieving jars.

For debug purpose i run:

ant -d | grep my-second-module

The output says:

sorting dependencies of com.mycompany.myproject#my-second-module / # of dependencies : 2

and that is correct, as the second module declares 2 external dependencies. I assume then ivy.xml for my-second-module is correctly fetched and parsed from the repository. Ivy then should know the dependencies of my-second-module

The problem is, ivy is not fetching those 2 transitive dependencies.

As you can see from the declaration I have specified I want to retrieve the default configuration, and it should be running transitive.

Upvotes: 0

Views: 2647

Answers (1)

Mark O&#39;Connor
Mark O&#39;Connor

Reputation: 77971

Impossible to diagnose anything without see how you've configured the projects.

The only advice I can offer is to generate an ivy dependency management report and take a look at the "default" configuration.

<target name="init" description="Resolve dependencies">
    <ivy:resolve/>
    <ivy:report todir="${build.dir}/ivy-report" graph="false"/>
    ..
    ..
</target>

Perhaps the transitive dependencies are being over-ridden by other resolved modules. For example it's possible for two modules to retrieve different revisions of the same module, in which case ivy will chose one and "evict" the other. Another possibility is a module declaring an exclusion, which would account for missing transitive dependencies.

Finally, let's be clear what you mean by "fetching".... Ivy will "resolve" dependencies, which means it will analyse each module and populate it's local cache with the various files. Ivy has a separate "retrieve" task for placing files into the local build workspace.

<ivy:retrieve pattern="${dist.dir}/WEB-INF/lib/[artifact].[ext]" conf="runtime"/>

So... This means when you run ivy, files may actually not be downloaded from the remote repository, because ivy already has them safely tucked away in it's cache. (normally located in $HOME/.ivy2/cache)

Upvotes: 5

Related Questions