You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by John Hungerford <Jo...@air2web.com> on 2007/12/18 22:26:45 UTC

Ivy uses the first set of configurations it sees when resolving multiple versions of a module

When I upgraded from ivy 2.0.0-alpha2 to 2.0.0-beta1, the ivy:resolve
task in my build file started failing while trying to resolve several
dependencies that worked in alpha 2.  After narrowing down the problem,
I've determined that ivy only honors the first set of configurations it
sees when it resolves multiple versions of a module.

For example, say I'm developing the foo module which depends on
commons-beanutils 1.6 and commons-beanutils 1.7.0.  (In real life foo
would only depend on 1.7.0 - this example represents the case where our
module depends on multiple version of an artifact due to transitive
dependencies, which is a very common occurrence in our enterprise
repository.)  

Here's the ivy.xml file for foo:

<ivy-module version="1.3">
	<info organisation="acme" module="foo" revision="1.0" />
	<configurations>
		<conf name="default" extends="master,runtime" />
		<conf name="master" description="This module's artifact"
/>
		<conf name="runtime" description="Mandatory runtime
dependencies" />
	</configurations>
	<publications>
		<artifact name="foo" type="jar" conf="master" />
	</publications>
	<dependencies defaultconfmapping="*->default">
		<dependency org="apache" name="commons-beanutils"
rev="1.6" conf="runtime" />
		<dependency org="apache" name="commons-beanutils"
rev="1.7.0" conf="runtime" />
	</dependencies>
</ivy-module>


Commons-beanutils 1.6 declares three configurations:
<ivy-module version="1.3">
	<info organisation="apache" module="commons-beanutils"
revision="1.6" status="integration"/>
	<configurations>
		<conf name="default" extends="runtime,master"/>
		<conf name="master" />
		<conf name="runtime" />
	</configurations>
	<publications>
		<artifact name="commons-beanutils" type="jar"
conf="master"/>
	</publications>
</ivy-module>


Finally, commons-beanutils 1.7.0 only declares the default
configuration:
<ivy-module version="1.3">
	<info organisation="apache" module="commons-beanutils"
revision="1.7.0" status="release" />
	<configurations>
		<conf name="default" />
	</configurations>
	<publications>
		<artifact name="commons-beanutils" type="jar"
conf="default" />
	</publications>
</ivy-module>


When I try to resolve the dependencies for foo, ivy tries to resolve the
master and runtime configurations for commons-beanutils 1.7.0.  When I
swap the order of the dependencies in foo's ivy.xml file, ivy only tries
to resolve the default configuration of commons-beanutils 1.6.  This
didn't occur in alpha2.  Is ivy behaving as expected?  I think it should
resolve the default, master, and runtime configurations in
commons-beanutils 1.6 and the default configuration in 1.7.0.  I can
post ant's verbose output if it would help.

Keep up all the great work!

John Hungerford
Co-op Developer
Air2Web