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/19 00:30:52 UTC

Conflicting module configurations

I'm new to ivy and mailing lists, so I apologize if this message is a
duplicate.  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


RE: Conflicting module configurations

Posted by John Hungerford <Jo...@air2web.com>.
On Dec 19, 2007 12:56 PM, Xavier Hanin <Xa...@gmail.com>
Wrote:

> Ok, it really sounds like a bug, it seems Ivy is confused with the
> configurations extension. Could you open a JIRA issue with the same 
> details as provided here?

> Xavier

Sure, I created IVY-681 to track this issue.

Re: Conflicting module configurations

Posted by Xavier Hanin <xa...@gmail.com>.
On Dec 19, 2007 6:38 PM, John Hungerford <Jo...@air2web.com>
wrote:

> On Dec 19, 2007 11:25 AM, Xavier Hanin <Xa...@gmail.com>
> wrote:
>
> > Ivy doesn't actually support depending on the same module twice, even
> > though we have never made this appear as an error. Having two versions
> of
> > a module requested through transitive dependencies is handled
> differently
> > in Ivy, so I'd recommend trying to reproduce the problem whilst still
> > using transitive dependencies. For instance #A;1.0->
> > {#B;1.0 #commons-beanutils;1.6} and #B;1.0->#commons-beanutils;1.7.
>
>
> Thanks for your quick response!  Originally, my project depended on the
> same module twice due to transitive dependencies, but ivy's behavior
> didn't change when I took out the middle module.  Here's the new setup
> I'm using:
> #foo;1.0->{#commons-beanutils;1.6 #bar;1.1}
> #bar;1.1->#commons-beanutils;1.7
>
> #commons-beanutils;1.6 has a default configuration, which extends master
> and runtime.  It publishes its artifact in the master config.
> #commons-beanutils;1.7 only has a default configuration.  It publishes
> its artifact in the default config.
>
>
> > This is a problem of conflict resolution, and really depend on how you
>
> > configure your conflict management, and the order of the dependencies.
> If
> > Ivy find 1.6 before 1.7, it will try to resolve the default conf
> (since
> > you ask for it when you say runtime with
> defaultconfmapping=*->default),
> > which in turn extends master and runtime conf in beanutils 1.6. Later
> it
> > will find 1.7, select it and evict 1.6 (if your conflict manager says
> so),
> > and merge information from the 1.6 revision to the 1.7. The
> information
> > merged is the callers (ie dependers) the required confs (in your case
> > default in both cases), the root module configuration in which the
> module
> > is needed, the dependency artifacts declared by dependers if any (none
> in
> > your case) and the current state of which configurations have been
> loaded.
> > So even though Ivy has loaded the runtime and master conf for 1.6, the
>
> > selection of 1.7 will just consider the dependencies of 1.7 in its
> default
> > conf.
>
>
> This is exactly how I expect ivy to behave.  The problem I'm
> experiencing is that when ivy considers the default configuration of
> 1.7, it also checks the master and runtime configurations even though
> 1.7's default configuration doesn't extend master or runtime.  1.6's
> default configuration did extended master and runtime, so I think ivy is
> hanging on to 1.6's configuration setup when it evicted 1.6.  Since
> 1.7's default configuration doesn't extend any other configurations, I
> think ivy should just consider the default configuration when it
> resolves the dependencies of 1.7.  Do you agree with this behavior, or
> am I missing something obvious?

I agree.



>
>
>
> > If Ivy finds 1.7 before 1.6 it will evict 1.6 before actually
> resolving
> > its dependencies, which will save the time of resolving 1.6
> dependencies,
> > but shouldn't alter the final result of dependencies.
>
> > So I don't know if this is actually what you encounter in your use
> case,
> > I'm not sure to get exactly what's going wrong for you. If you think
> Ivy
> > doesn't behave like I've explained, give some more details (including
> > verbose log), but before try to use transitive dependencies instead of
>
> > declaring the same dependency twice.
>
>
> Here's the verbose output from my buildfile.  Notice that ivy tries to
> resolve the master and runtime dependencies of #commons-beanutils;1.7.0
> even though it only has a default configuration:
>
> Apache Ant version 1.6.5 compiled on June 2 2005
> Buildfile: C:\workspace\test-repo\build.xml
> parsing buildfile C:\workspace\test-repo\build.xml with URI =
> file:///C:/workspace/test-repo/build.xml
> Project base dir set to: C:\workspace\test-repo
> Build sequence for target(s) `ivy-resolve' is [ivy-install, ivy-resolve]
> Complete build sequence is [ivy-install, ivy-resolve, ivy-clean, ]
> ivy-install:
> parsing buildfile
> jar:file:/C:/workspace/test-repo/ivy-2.0.0-beta1.jar!/org/apache/ivy/ant
> /antlib.xml with URI =
> jar:file:/C:/workspace/test-repo/ivy-2.0.0-beta1.jar!/org/apache/ivy/ant
> /antlib.xml
> ivy-resolve:
> Loading
> jar:file:/C:/workspace/test-repo/ivy-2.0.0-beta1.jar!/org/apache/ivy/cor
> e/settings/ivy.properties
> [ivy:resolve] :: Ivy 2.0.0-beta1 - 20071206070608 ::
> http://ant.apache.org/ivy/ ::
> :: loading settings :: file = C:\workspace\test-repo\ivysettings.xml
> no default ivy user dir defined: set to C:\Documents and
> Settings\hungerford_j\.ivy2
> no default cache defined: set to C:\Documents and
> Settings\hungerford_j\.ivy2\cache
> settings loaded (94ms)
>        default cache: C:\workspace\test-repo\cache
>        default resolver: local-test
>        -- 1 resolvers:
>        local-test [file]
> [ivy:resolve] using ivy parser to parse
> file:/C:/workspace/test-repo/ivy.xml
> [ivy:resolve] :: resolving dependencies :: acme#foo;1.0
> [ivy:resolve]   confs: [default, master, runtime]
> [ivy:resolve]   validate = true
> [ivy:resolve] resolving dependencies for configuration 'default'
> [ivy:resolve] == resolving dependencies for acme#foo;1.0 [default]
> [ivy:resolve] == resolving dependencies for acme#foo;1.0 [master]
> [ivy:resolve] == resolving dependencies for acme#foo;1.0 [runtime]
> [ivy:resolve] == resolving dependencies
> acme#foo;1.0->apache#commons-beanutils;1.6 [runtime->default]
> [ivy:resolve]           tried
> C:\workspace\test-repo/apache/commons-beanutils/ivys/ivy-1.6.xml
> [ivy:resolve]   local-test: found md file for
> apache#commons-beanutils;1.6
> [ivy:resolve]           =>
> C:\workspace\test-repo\apache\commons-beanutils\ivys\ivy-1.6.xml (1.6)
> [ivy:resolve] downloading
> C:\workspace\test-repo\apache\commons-beanutils\ivys\ivy-1.6.xml ...
> [ivy:resolve]   local-test: downloading
> C:\workspace\test-repo\apache\commons-beanutils\ivys\ivy-1.6.xml
> [ivy:resolve]   [SUCCESSFUL ]
> apache#commons-beanutils;1.6!ivy.original.xml(ivy) (16ms)
> [ivy:resolve]   found apache#commons-beanutils;1.6 in local-test
> [ivy:resolve] == resolving dependencies
> acme#foo;1.0->apache#commons-beanutils;1.6 [runtime->runtime]
> [ivy:resolve] == resolving dependencies
> acme#foo;1.0->apache#commons-beanutils;1.6 [runtime->master]
> [ivy:resolve] == resolving dependencies acme#foo;1.0->acme#bar;1.1
> [runtime->default]
> [ivy:resolve]           tried
> C:\workspace\test-repo/acme/bar/ivys/ivy-1.1.xml
> [ivy:resolve]   local-test: found md file for acme#bar;1.1
> [ivy:resolve]           =>
> C:\workspace\test-repo\acme\bar\ivys\ivy-1.1.xml (1.1)
> [ivy:resolve] downloading
> C:\workspace\test-repo\acme\bar\ivys\ivy-1.1.xml ...
> [ivy:resolve]   local-test: downloading
> C:\workspace\test-repo\acme\bar\ivys\ivy-1.1.xml
> [ivy:resolve]   [SUCCESSFUL ] acme#bar;1.1!ivy.original.xml(ivy) (16ms)
> [ivy:resolve]   found acme#bar;1.1 in local-test
> [ivy:resolve] == resolving dependencies acme#foo;1.0->acme#bar;1.1
> [runtime->master]
> [ivy:resolve] == resolving dependencies acme#foo;1.0->acme#bar;1.1
> [runtime->runtime]
> [ivy:resolve] == resolving dependencies
> acme#bar;1.1->apache#commons-beanutils;1.7.0 [runtime->default]
> [ivy:resolve]           tried
> C:\workspace\test-repo/apache/commons-beanutils/ivys/ivy-1.7.0.xml
> [ivy:resolve]   local-test: found md file for
> apache#commons-beanutils;1.7.0
> [ivy:resolve]           =>
> C:\workspace\test-repo\apache\commons-beanutils\ivys\ivy-1.7.0.xml
> (1.7.0)
> [ivy:resolve] downloading
> C:\workspace\test-repo\apache\commons-beanutils\ivys\ivy-1.7.0.xml ...
> [ivy:resolve]   local-test: downloading
> C:\workspace\test-repo\apache\commons-beanutils\ivys\ivy-1.7.0.xml
> [ivy:resolve]   [SUCCESSFUL ]
> apache#commons-beanutils;1.7.0!ivy.original.xml(ivy) (16ms)
> [ivy:resolve]   found apache#commons-beanutils;1.7.0 in local-test
> [ivy:resolve] == resolving dependencies
> acme#bar;1.1->apache#commons-beanutils;1.7.0 [runtime->runtime]
> [ivy:resolve] == resolving dependencies
> acme#bar;1.1->apache#commons-beanutils;1.7.0 [runtime->master]
> [ivy:resolve] resolving dependencies for configuration 'master'
> [ivy:resolve] == resolving dependencies for acme#foo;1.0 [master]
> [ivy:resolve] resolving dependencies for configuration 'runtime'
> [ivy:resolve] == resolving dependencies for acme#foo;1.0 [runtime]
> [ivy:resolve] == resolving dependencies
> acme#foo;1.0->apache#commons-beanutils;1.6 [runtime->default]
> [ivy:resolve] == resolving dependencies
> acme#foo;1.0->apache#commons-beanutils;1.6 [runtime->runtime]
> [ivy:resolve] == resolving dependencies
> acme#foo;1.0->apache#commons-beanutils;1.6 [runtime->master]
> [ivy:resolve] == resolving dependencies acme#foo;1.0->acme#bar;1.1
> [runtime->default]
> [ivy:resolve] == resolving dependencies acme#foo;1.0->acme#bar;1.1
> [runtime->master]
> [ivy:resolve] == resolving dependencies acme#foo;1.0->acme#bar;1.1
> [runtime->runtime]
> [ivy:resolve] == resolving dependencies
> acme#bar;1.1->apache#commons-beanutils;1.7.0 [runtime->default]
> [ivy:resolve] == resolving dependencies
> acme#bar;1.1->apache#commons-beanutils;1.7.0 [runtime->runtime]
> [ivy:resolve] == resolving dependencies
> acme#bar;1.1->apache#commons-beanutils;1.7.0 [runtime->master]
> [ivy:resolve]   resolved ivy file produced in
> C:\workspace\test-repo\cache\resolved-acme-foo-1.0.xml
> [ivy:resolve] :: downloading artifacts ::
> [ivy:resolve]           tried
> C:\workspace\test-repo/acme/bar/jars/bar-1.1.jar
> [ivy:resolve] downloading
> C:\workspace\test-repo\acme\bar\jars\bar-1.1.jar ...
> [ivy:resolve]   local-test: downloading
> C:\workspace\test-repo\acme\bar\jars\bar-1.1.jar
> [ivy:resolve] . (0kB)
> [ivy:resolve]   [SUCCESSFUL ] acme#bar;1.1!bar.jar (0ms)
> [ivy:resolve] :: resolution report :: resolve 531ms :: artifacts dl 16ms
> [ivy:resolve]   :: evicted modules:
> [ivy:resolve]   apache#commons-beanutils;1.6 by
> [apache#commons-beanutils;1.7.0] in [runtime, default]
> [ivy:resolve]     in acme#foo;1.0 with latest-revision
> [ivy:resolve]     in acme#foo;1.0 with latest-revision
>
> ---------------------------------------------------------------------
>        |                  |            modules            ||
> artifacts   |
>        |       conf       | number| search|dwnlded|evicted||
> number|dwnlded|
>
> ---------------------------------------------------------------------
>        |      default     |   3   |   3   |   0   |   1   ||   1   |
> 1   |
>        |      master      |   0   |   0   |   0   |   0   ||   0   |
> 0   |
>        |      runtime     |   3   |   3   |   0   |   1   ||   1   |
> 1   |
>
> ---------------------------------------------------------------------
> [ivy:resolve] WARN:     ::::::::::::::::::::::::::::::::::::::::::::::
> [ivy:resolve] WARN:     ::          UNRESOLVED DEPENDENCIES         ::
> [ivy:resolve] WARN:     ::::::::::::::::::::::::::::::::::::::::::::::
> [ivy:resolve] WARN:     :: apache#commons-beanutils;1.7.0:
> configuration(s) not found in apache#commons-beanutils;1.7.0: master. It
> was required from acme#bar;1.1 runtime
> [ivy:resolve] WARN:     ::::::::::::::::::::::::::::::::::::::::::::::
> [ivy:resolve]   report for acme#foo;1.0 default produced in
> C:\workspace\test-repo\cache\acme-foo-default.xml
> [ivy:resolve]   report for acme#foo;1.0 master produced in
> C:\workspace\test-repo\cache\acme-foo-master.xml
> [ivy:resolve]   report for acme#foo;1.0 runtime produced in
> C:\workspace\test-repo\cache\acme-foo-runtime.xml
> [ivy:resolve]   resolve done (531ms resolve - 16ms download)
> [ivy:resolve] :: problems summary ::
> [ivy:resolve] :::: WARNINGS
> [ivy:resolve]           ::::::::::::::::::::::::::::::::::::::::::::::
> [ivy:resolve]           ::          UNRESOLVED DEPENDENCIES         ::
> [ivy:resolve]           ::::::::::::::::::::::::::::::::::::::::::::::
> [ivy:resolve]           :: apache#commons-beanutils;1.7.0:
> configuration(s) not found in apache#commons-beanutils;1.7.0: master. It
> was required from acme#bar;1.1 runtime
> [ivy:resolve]           ::::::::::::::::::::::::::::::::::::::::::::::
> [ivy:resolve]
> [ivy:resolve]
> [ivy:resolve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
>
> BUILD FAILED
> C:\workspace\test-repo\build.xml:21: impossible to resolve dependencies:
> *Standard failure stacktrace follows...*

Ok, it really sounds like a bug, it seems Ivy is confused with the
configurations extension. Could you open a JIRA issue with the same details
as provided here?

Xavier


>
>
>
> Thanks for your help,
> John
>



-- 
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/

RE: Conflicting module configurations

Posted by John Hungerford <Jo...@air2web.com>.
On Dec 19, 2007 11:25 AM, Xavier Hanin <Xa...@gmail.com>
wrote: 

> Ivy doesn't actually support depending on the same module twice, even 
> though we have never made this appear as an error. Having two versions
of 
> a module requested through transitive dependencies is handled
differently 
> in Ivy, so I'd recommend trying to reproduce the problem whilst still 
> using transitive dependencies. For instance #A;1.0->
> {#B;1.0 #commons-beanutils;1.6} and #B;1.0->#commons-beanutils;1.7.


Thanks for your quick response!  Originally, my project depended on the
same module twice due to transitive dependencies, but ivy's behavior
didn't change when I took out the middle module.  Here's the new setup
I'm using:
#foo;1.0->{#commons-beanutils;1.6 #bar;1.1}
#bar;1.1->#commons-beanutils;1.7

#commons-beanutils;1.6 has a default configuration, which extends master
and runtime.  It publishes its artifact in the master config.
#commons-beanutils;1.7 only has a default configuration.  It publishes
its artifact in the default config.


> This is a problem of conflict resolution, and really depend on how you

> configure your conflict management, and the order of the dependencies.
If 
> Ivy find 1.6 before 1.7, it will try to resolve the default conf
(since 
> you ask for it when you say runtime with
defaultconfmapping=*->default), 
> which in turn extends master and runtime conf in beanutils 1.6. Later
it 
> will find 1.7, select it and evict 1.6 (if your conflict manager says
so), 
> and merge information from the 1.6 revision to the 1.7. The
information 
> merged is the callers (ie dependers) the required confs (in your case 
> default in both cases), the root module configuration in which the
module 
> is needed, the dependency artifacts declared by dependers if any (none
in 
> your case) and the current state of which configurations have been
loaded. 
> So even though Ivy has loaded the runtime and master conf for 1.6, the

> selection of 1.7 will just consider the dependencies of 1.7 in its
default 
> conf.


This is exactly how I expect ivy to behave.  The problem I'm
experiencing is that when ivy considers the default configuration of
1.7, it also checks the master and runtime configurations even though
1.7's default configuration doesn't extend master or runtime.  1.6's
default configuration did extended master and runtime, so I think ivy is
hanging on to 1.6's configuration setup when it evicted 1.6.  Since
1.7's default configuration doesn't extend any other configurations, I
think ivy should just consider the default configuration when it
resolves the dependencies of 1.7.  Do you agree with this behavior, or
am I missing something obvious?


> If Ivy finds 1.7 before 1.6 it will evict 1.6 before actually
resolving 
> its dependencies, which will save the time of resolving 1.6
dependencies, 
> but shouldn't alter the final result of dependencies.

> So I don't know if this is actually what you encounter in your use
case, 
> I'm not sure to get exactly what's going wrong for you. If you think
Ivy 
> doesn't behave like I've explained, give some more details (including 
> verbose log), but before try to use transitive dependencies instead of

> declaring the same dependency twice.


Here's the verbose output from my buildfile.  Notice that ivy tries to
resolve the master and runtime dependencies of #commons-beanutils;1.7.0
even though it only has a default configuration:

Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: C:\workspace\test-repo\build.xml
parsing buildfile C:\workspace\test-repo\build.xml with URI =
file:///C:/workspace/test-repo/build.xml
Project base dir set to: C:\workspace\test-repo
Build sequence for target(s) `ivy-resolve' is [ivy-install, ivy-resolve]
Complete build sequence is [ivy-install, ivy-resolve, ivy-clean, ]
ivy-install:
parsing buildfile
jar:file:/C:/workspace/test-repo/ivy-2.0.0-beta1.jar!/org/apache/ivy/ant
/antlib.xml with URI =
jar:file:/C:/workspace/test-repo/ivy-2.0.0-beta1.jar!/org/apache/ivy/ant
/antlib.xml
ivy-resolve:
Loading
jar:file:/C:/workspace/test-repo/ivy-2.0.0-beta1.jar!/org/apache/ivy/cor
e/settings/ivy.properties
[ivy:resolve] :: Ivy 2.0.0-beta1 - 20071206070608 ::
http://ant.apache.org/ivy/ ::
:: loading settings :: file = C:\workspace\test-repo\ivysettings.xml
no default ivy user dir defined: set to C:\Documents and
Settings\hungerford_j\.ivy2
no default cache defined: set to C:\Documents and
Settings\hungerford_j\.ivy2\cache
settings loaded (94ms)
	default cache: C:\workspace\test-repo\cache
	default resolver: local-test
	-- 1 resolvers:
	local-test [file]
[ivy:resolve] using ivy parser to parse
file:/C:/workspace/test-repo/ivy.xml
[ivy:resolve] :: resolving dependencies :: acme#foo;1.0
[ivy:resolve] 	confs: [default, master, runtime]
[ivy:resolve] 	validate = true
[ivy:resolve] resolving dependencies for configuration 'default'
[ivy:resolve] == resolving dependencies for acme#foo;1.0 [default]
[ivy:resolve] == resolving dependencies for acme#foo;1.0 [master]
[ivy:resolve] == resolving dependencies for acme#foo;1.0 [runtime]
[ivy:resolve] == resolving dependencies
acme#foo;1.0->apache#commons-beanutils;1.6 [runtime->default]
[ivy:resolve] 		tried
C:\workspace\test-repo/apache/commons-beanutils/ivys/ivy-1.6.xml
[ivy:resolve] 	local-test: found md file for
apache#commons-beanutils;1.6
[ivy:resolve] 		=>
C:\workspace\test-repo\apache\commons-beanutils\ivys\ivy-1.6.xml (1.6)
[ivy:resolve] downloading
C:\workspace\test-repo\apache\commons-beanutils\ivys\ivy-1.6.xml ...
[ivy:resolve] 	local-test: downloading
C:\workspace\test-repo\apache\commons-beanutils\ivys\ivy-1.6.xml
[ivy:resolve] 	[SUCCESSFUL ]
apache#commons-beanutils;1.6!ivy.original.xml(ivy) (16ms)
[ivy:resolve] 	found apache#commons-beanutils;1.6 in local-test
[ivy:resolve] == resolving dependencies
acme#foo;1.0->apache#commons-beanutils;1.6 [runtime->runtime]
[ivy:resolve] == resolving dependencies
acme#foo;1.0->apache#commons-beanutils;1.6 [runtime->master]
[ivy:resolve] == resolving dependencies acme#foo;1.0->acme#bar;1.1
[runtime->default]
[ivy:resolve] 		tried
C:\workspace\test-repo/acme/bar/ivys/ivy-1.1.xml
[ivy:resolve] 	local-test: found md file for acme#bar;1.1
[ivy:resolve] 		=>
C:\workspace\test-repo\acme\bar\ivys\ivy-1.1.xml (1.1)
[ivy:resolve] downloading
C:\workspace\test-repo\acme\bar\ivys\ivy-1.1.xml ...
[ivy:resolve] 	local-test: downloading
C:\workspace\test-repo\acme\bar\ivys\ivy-1.1.xml
[ivy:resolve] 	[SUCCESSFUL ] acme#bar;1.1!ivy.original.xml(ivy) (16ms)
[ivy:resolve] 	found acme#bar;1.1 in local-test
[ivy:resolve] == resolving dependencies acme#foo;1.0->acme#bar;1.1
[runtime->master]
[ivy:resolve] == resolving dependencies acme#foo;1.0->acme#bar;1.1
[runtime->runtime]
[ivy:resolve] == resolving dependencies
acme#bar;1.1->apache#commons-beanutils;1.7.0 [runtime->default]
[ivy:resolve] 		tried
C:\workspace\test-repo/apache/commons-beanutils/ivys/ivy-1.7.0.xml
[ivy:resolve] 	local-test: found md file for
apache#commons-beanutils;1.7.0
[ivy:resolve] 		=>
C:\workspace\test-repo\apache\commons-beanutils\ivys\ivy-1.7.0.xml
(1.7.0)
[ivy:resolve] downloading
C:\workspace\test-repo\apache\commons-beanutils\ivys\ivy-1.7.0.xml ...
[ivy:resolve] 	local-test: downloading
C:\workspace\test-repo\apache\commons-beanutils\ivys\ivy-1.7.0.xml
[ivy:resolve] 	[SUCCESSFUL ]
apache#commons-beanutils;1.7.0!ivy.original.xml(ivy) (16ms)
[ivy:resolve] 	found apache#commons-beanutils;1.7.0 in local-test
[ivy:resolve] == resolving dependencies
acme#bar;1.1->apache#commons-beanutils;1.7.0 [runtime->runtime]
[ivy:resolve] == resolving dependencies
acme#bar;1.1->apache#commons-beanutils;1.7.0 [runtime->master]
[ivy:resolve] resolving dependencies for configuration 'master'
[ivy:resolve] == resolving dependencies for acme#foo;1.0 [master]
[ivy:resolve] resolving dependencies for configuration 'runtime'
[ivy:resolve] == resolving dependencies for acme#foo;1.0 [runtime]
[ivy:resolve] == resolving dependencies
acme#foo;1.0->apache#commons-beanutils;1.6 [runtime->default]
[ivy:resolve] == resolving dependencies
acme#foo;1.0->apache#commons-beanutils;1.6 [runtime->runtime]
[ivy:resolve] == resolving dependencies
acme#foo;1.0->apache#commons-beanutils;1.6 [runtime->master]
[ivy:resolve] == resolving dependencies acme#foo;1.0->acme#bar;1.1
[runtime->default]
[ivy:resolve] == resolving dependencies acme#foo;1.0->acme#bar;1.1
[runtime->master]
[ivy:resolve] == resolving dependencies acme#foo;1.0->acme#bar;1.1
[runtime->runtime]
[ivy:resolve] == resolving dependencies
acme#bar;1.1->apache#commons-beanutils;1.7.0 [runtime->default]
[ivy:resolve] == resolving dependencies
acme#bar;1.1->apache#commons-beanutils;1.7.0 [runtime->runtime]
[ivy:resolve] == resolving dependencies
acme#bar;1.1->apache#commons-beanutils;1.7.0 [runtime->master]
[ivy:resolve] 	resolved ivy file produced in
C:\workspace\test-repo\cache\resolved-acme-foo-1.0.xml
[ivy:resolve] :: downloading artifacts ::
[ivy:resolve] 		tried
C:\workspace\test-repo/acme/bar/jars/bar-1.1.jar
[ivy:resolve] downloading
C:\workspace\test-repo\acme\bar\jars\bar-1.1.jar ...
[ivy:resolve] 	local-test: downloading
C:\workspace\test-repo\acme\bar\jars\bar-1.1.jar
[ivy:resolve] . (0kB)
[ivy:resolve] 	[SUCCESSFUL ] acme#bar;1.1!bar.jar (0ms)
[ivy:resolve] :: resolution report :: resolve 531ms :: artifacts dl 16ms
[ivy:resolve] 	:: evicted modules:
[ivy:resolve] 	apache#commons-beanutils;1.6 by
[apache#commons-beanutils;1.7.0] in [runtime, default]
[ivy:resolve] 	  in acme#foo;1.0 with latest-revision
[ivy:resolve] 	  in acme#foo;1.0 with latest-revision
	
---------------------------------------------------------------------
	|                  |            modules            ||
artifacts   |
	|       conf       | number| search|dwnlded|evicted||
number|dwnlded|
	
---------------------------------------------------------------------
	|      default     |   3   |   3   |   0   |   1   ||   1   |
1   |
	|      master      |   0   |   0   |   0   |   0   ||   0   |
0   |
	|      runtime     |   3   |   3   |   0   |   1   ||   1   |
1   |
	
---------------------------------------------------------------------
[ivy:resolve] WARN: 	::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] WARN: 	::          UNRESOLVED DEPENDENCIES         ::
[ivy:resolve] WARN: 	::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] WARN: 	:: apache#commons-beanutils;1.7.0:
configuration(s) not found in apache#commons-beanutils;1.7.0: master. It
was required from acme#bar;1.1 runtime
[ivy:resolve] WARN: 	::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] 	report for acme#foo;1.0 default produced in
C:\workspace\test-repo\cache\acme-foo-default.xml
[ivy:resolve] 	report for acme#foo;1.0 master produced in
C:\workspace\test-repo\cache\acme-foo-master.xml
[ivy:resolve] 	report for acme#foo;1.0 runtime produced in
C:\workspace\test-repo\cache\acme-foo-runtime.xml
[ivy:resolve] 	resolve done (531ms resolve - 16ms download)
[ivy:resolve] :: problems summary ::
[ivy:resolve] :::: WARNINGS
[ivy:resolve] 		::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] 		::          UNRESOLVED DEPENDENCIES         ::
[ivy:resolve] 		::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] 		:: apache#commons-beanutils;1.7.0:
configuration(s) not found in apache#commons-beanutils;1.7.0: master. It
was required from acme#bar;1.1 runtime
[ivy:resolve] 		::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] 
[ivy:resolve] 
[ivy:resolve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS

BUILD FAILED
C:\workspace\test-repo\build.xml:21: impossible to resolve dependencies:
*Standard failure stacktrace follows...*


Thanks for your help,
John

Re: Conflicting module configurations

Posted by Xavier Hanin <xa...@gmail.com>.
On Dec 19, 2007 12:30 AM, John Hungerford <Jo...@air2web.com>
wrote:

> I'm new to ivy and mailing lists, so I apologize if this message is a
> duplicate.  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.)

Ivy doesn't actually support depending on the same module twice, even though
we have never made this appear as an error. Having two versions of a module
requested through transitive dependencies is handled differently in Ivy, so
I'd recommend trying to reproduce the problem whilst still using transitive
dependencies. For instance #A;1.0->{#B;1.0 #commons-beanutils;1.6} and
#B;1.0->#commons-beanutils;1.7.


>
> 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.


This is a problem of conflict resolution, and really depend on how you
configure your conflict management, and the order of the dependencies. If
Ivy find 1.6 before 1.7, it will try to resolve the default conf (since you
ask for it when you say runtime with defaultconfmapping=*->default), which
in turn extends master and runtime conf in beanutils 1.6. Later it will find
1.7, select it and evict 1.6 (if your conflict manager says so), and merge
information from the 1.6 revision to the 1.7. The information merged is the
callers (ie dependers) the required confs (in your case default in both
cases), the root module configuration in which the module is needed, the
dependency artifacts declared by dependers if any (none in your case) and
the current state of which configurations have been loaded. So even though
Ivy has loaded the runtime and master conf for 1.6, the selection of
1.7will just consider the dependencies of
1.7 in its default conf.

If Ivy finds 1.7 before 1.6 it will evict 1.6 before actually resolving its
dependencies, which will save the time of resolving 1.6 dependencies, but
shouldn't alter the final result of dependencies.

So I don't know if this is actually what you encounter in your use case, I'm
not sure to get exactly what's going wrong for you. If you think Ivy doesn't
behave like I've explained, give some more details (including verbose log),
but before try to use transitive dependencies instead of declaring the same
dependency twice.

HTH,

Xavier

>
>
> Keep up all the great work!
>
> John Hungerford
> Co-op Developer
> Air2Web
>
>


-- 
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/