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 Daniel Dekany <dd...@freemail.hu> on 2009/03/11 22:58:34 UTC

Re: [solved] How to prevent "unknown resolver" errors?

Wednesday, March 11, 2009, 7:22:42 PM, Daniel Dekany wrote:
> Wednesday, March 11, 2009, 5:26:04 PM, Brown, Carlton wrote:
>> It's documented, although the implications are not explained enough.
>> http://ant.apache.org/ivy/history/latest-release/concept.html#cache 
>>
>> The subtle part is that Ivy actually uses 2 caches, a resolution cache
>> and a repository cache.
[snip]
> But I guess I shouldn't use ${user.home}/.ivy2/cache as
> *repository* cache either. Certainly some other projects will use that
> too, and if they don't use lockStrategy="artifact-lock"... and I bet
> most will not. Well, it's rarely a problem, as two projects had to be
> built in parallel for that to be problem... but still, does it boil
> down to that most projects (or company) should use it's own caches
> (and not forgetting to set the *resolution* caches too)?
[snip]

To answer my above question... I now tried using separate *resolution*
caches for each ivysetting.xml-s, but with the common per-user
*repository* cache, ${user.home}/.ivy2/cache. As the
ivysetting.xml-specific resolver names still get into
${user.home}/.ivy2/cache (yes, into the *repository* cache part of
it), it can still cause "undefined resolver" errors in *other*
projects that use ${user.home}/.ivy2/cache too. It doesn't cause
errors in my project though, as it knows the custom resolvers.


OK, so to recapitulate for the mail archives (experts please correct
where I'm mistaken):

First, note that there is *repository* cache VS *resolution* cache:
http://ant.apache.org/ivy/history/latest-release/concept.html#cache

It seems to me, the only safe solution is using a separate
*repository* cache for each ivysettings.xml (at least), but it's
enough to associate that cache with the custom resolvers (not to the
built-in resolvers like "default", "local" and like; those you can
<include> in your ivysettings.xml), so the cache of the Ibiblio
artifacts can still remain global. Oh, and
lockStrategy="artifact-lock" should not be forgotten if the repository
cache will be accessed concurrently.

Also, if I get it right, you should use at least one *resolution*
cache per ivysettings.xml per user account, and that you better
associate to each resolvers, i.e. even to the built-in ones. Actually
I have to do it with even finer granularity: I use one resolution
cache per ivysettings.xml per user account per project, because two
projects that use the same ivysettings.xml may be built in parallel
(automated integration builds on the server).

Well... I hope people after me will Google for Ivy "unknown resolver"
with greater success.

>> -----Original Message-----
>> From: Daniel Dekany [mailto:ddekany@freemail.hu] 
>> Sent: Wednesday, March 11, 2009 12:19 PM
>> To: Brown, Carlton
>> Cc: ivy-user@ant.apache.org
>> Subject: Re: How to prevent "unknown resolver" errors?
>>
>> Wednesday, March 11, 2009, 4:28:52 PM, Brown, Carlton wrote:
>>
>>> Are you overriding the defaultCache attribute in your ivysettings 
>>> file, or are you just defining caches as attributes of resolvers?
>>
>> Aha! I only set the last. I never realized that <caches
>> defaultCacheDir="..."> does what it does. It seems it solves the
>> problem, so thanks a lot! (I believe I read all the pages about the
>> concepts, but don't remember this things was addressed. If it isn't, it
>> should be.)
>>
>>> -----Original Message-----
>>> From: Daniel Dekany [mailto:ddekany@freemail.hu]
>>> Sent: Monday, March 09, 2009 12:47 PM
>>> To: ivy-user@ant.apache.org
>>> Subject: How to prevent "unknown resolver" errors?
>>>
>>> I declared own cache for all resolvers that I use, and that solved 
>>> this problem for a while. But if I resolve something that is also in 
>>> the default cache of Ivy (I mean ${user.home}/.ivy2/cache) the project
>>
>>> pollutes or otherwise access it, and that will cause "unknown
>> resolver"
>>> errors again.
>>>
>>> For example, I store ant#ant in my own repo, called "myResolver", 
>>> which uses its own cache. Still, if the default cache of Ivy also 
>>> contains ant#ant (same revision), when I ivy:resolve in my project, 
>>> ${user.home}/.ivy2/cache/ant/ant/ivydata-[revision].properties is 
>>> modified so that it's last line will be resolver=myResolver. Thus, 
>>> when something else than my project uses the ${user.home}/.ivy2/cache 
>>> later to get ant#ant, I get a "unknown resolver myResolver" error. Why
>>
>>> does my project touch the default cache at all when I set a 
>>> project-specific cache for all resolvers that it uses?
>>>
>>> --
>>> Best regards,
>>>  Daniel Dekany
>>>
>>>
>>> -----------------------------------------
>>> ====================================================
>>> This message contains PRIVILEGED and CONFIDENTIAL information that is 
>>> intended only for use by the named recipient. If you are not the named
>>
>>> recipient, any disclosure, dissemination, or action based on the 
>>> contents of this message is prohibited. In such case please notify us 
>>> and destroy and delete all copies of this transmission.  Thank you.
>>> ====================================================
>>>
>>
>> --
>> Best regards,
>>  Daniel Dekany


-- 
Best regards,
 Daniel Dekany


Re: [solved] How to prevent "unknown resolver" errors?

Posted by Daniel Dekany <dd...@freemail.hu>.
Thursday, March 12, 2009, 6:33:27 PM, Brown, Carlton wrote:

>> -----Original Message-----
>> From: Daniel Dekany [mailto:ddekany@freemail.hu] 
>> Sent: Thursday, March 12, 2009 10:40 AM
>> To: Brown, Carlton
>> Subject: Re: [solved] How to prevent "unknown resolver" errors?
>> 
> [snip]
>> >> 
>> >> To answer my above question... I now tried using separate
>> >> *resolution* caches for each ivysetting.xml-s, but with the common 
>> >> per-user
>> >> *repository* cache, ${user.home}/.ivy2/cache.  As the 
>> >> ivysetting.xml-specific resolver names still get into 
>> >> ${user.home}/.ivy2/cache (yes, into the *repository* cache part of 
>> >> it), it can still cause "undefined resolver" errors in *other* 
>> >> projects that use ${user.home}/.ivy2/cache too. It doesn't cause 
>> >> errors in my project though, as it knows the custom resolvers.
>> >
>> > If you're getting this behavior, think you've either made 
>> an error in
>> > configuration or uncovered a bug.   Could you post your respective
>> > config files rather than describing what you did?  
>> 
>> I would believe that the authors are aware of this. Simply, 
>> the name of the last resolver of an artifact is stored in the 
>> ivydata-[revision].properties file as the "resolver" 
>> property. And that file belongs to the repository cache, not 
>> to the resolution cache, right?
>
> Correct, it was my mistake. The repository cache does contain
> resolver information (at least as of 2.0.0). I think the design is
> sound... The cache should contain some resolver state, otherwise it
> couldn't work offline and still respect the resolvers that Ivy does
> know about.

(In my experience it can't work safely off-line anyway... unless you
create a local mirror repository, of course.)

> But I think the "unknown resolver" error is a bug... in
> my opinion Ivy shouldn't error out if it encounters an unknown
> resolver, as long as the resolver doesn't get used. You can go here
> and open a bug and see if the developers agree:
> https://issues.apache.org/jira/browse/IVY

Ugh... I'm shy about reporting this particular one. I already filled a
few reports, where I'm quite confident Ivy behaves badly. But this...
I at best have blurry ideas regarding how that information is supposed
to be used. I rather filled a documentation improvement request
regarding cache setup and multiple ivysettings.xml-s...

> [snip]
>> Simply, since multiple projects use the same ivysettings.xml, 
>> and they may be built in parallel (think about a continuos 
>> integration server), and the resolution caches shouldn't be 
>> accessed concurrently (according to the Ivy docs), I think I 
>> can't use just one resolution cache per ivysettings.xml. Can 
>> I?
>
> You can specify the default cache as a property and then override it
> from the build script before you call ivy:settings.

Yes, for example. Hence you have one resolution cache per project,
rather than one per ivysettings.xml.

-- 
Best regards,
 Daniel Dekany


RE: [solved] How to prevent "unknown resolver" errors?

Posted by "Brown, Carlton" <Ca...@compucredit.com>.
 > -----Original Message-----
> From: Daniel Dekany [mailto:ddekany@freemail.hu] 
> Sent: Thursday, March 12, 2009 10:40 AM
> To: Brown, Carlton
> Subject: Re: [solved] How to prevent "unknown resolver" errors?
> 
[snip]
> >> 
> >> To answer my above question... I now tried using separate
> >> *resolution* caches for each ivysetting.xml-s, but with the common 
> >> per-user
> >> *repository* cache, ${user.home}/.ivy2/cache.  As the 
> >> ivysetting.xml-specific resolver names still get into 
> >> ${user.home}/.ivy2/cache (yes, into the *repository* cache part of 
> >> it), it can still cause "undefined resolver" errors in *other* 
> >> projects that use ${user.home}/.ivy2/cache too. It doesn't cause 
> >> errors in my project though, as it knows the custom resolvers.
> >
> > If you're getting this behavior, think you've either made 
> an error in
> > configuration or uncovered a bug.   Could you post your respective
> > config files rather than describing what you did?  
> 
> I would believe that the authors are aware of this. Simply, 
> the name of the last resolver of an artifact is stored in the 
> ivydata-[revision].properties file as the "resolver" 
> property. And that file belongs to the repository cache, not 
> to the resolution cache, right?

Correct, it was my mistake.   The repository cache does contain resolver
information (at least as of 2.0.0).  I think the design is sound... The
cache should contain some resolver state, otherwise it couldn't work
offline and still respect the resolvers that Ivy does know about.   But
I think the "unknown resolver" error is a bug... in my opinion Ivy
shouldn't error out if it encounters an unknown resolver, as long as the
resolver doesn't get used.   You can go here and open a bug and see if
the developers agree:  https://issues.apache.org/jira/browse/IVY

[snip]
> Simply, since multiple projects use the same ivysettings.xml, 
> and they may be built in parallel (think about a continuos 
> integration server), and the resolution caches shouldn't be 
> accessed concurrently (according to the Ivy docs), I think I 
> can't use just one resolution cache per ivysettings.xml. Can 
> I?

You can specify the default cache as a property and then override it
from the build script before you call ivy:settings.

-----------------------------------------
====================================================
This message contains PRIVILEGED and CONFIDENTIAL
information that is intended only for use by the 
named recipient. If you are not the named recipient,
any disclosure, dissemination, or action based on 
the contents of this message is prohibited. In such
case please notify us and destroy and delete all 
copies of this transmission.  Thank you.
====================================================

Re: [solved] How to prevent "unknown resolver" errors?

Posted by Daniel Dekany <dd...@freemail.hu>.
Thursday, March 12, 2009, 2:23:16 PM, Brown, Carlton wrote:

>> -----Original Message-----
>> From: Daniel Dekany [mailto:ddekany@freemail.hu] 
>> Sent: Wednesday, March 11, 2009 5:59 PM
>> To: Daniel Dekany
>> Subject: Re: [solved] How to prevent "unknown resolver" errors?
>> 
>> Wednesday, March 11, 2009, 7:22:42 PM, Daniel Dekany wrote:
>> > Wednesday, March 11, 2009, 5:26:04 PM, Brown, Carlton wrote:
>> >> It's documented, although the implications are not 
>> explained enough.
>> >> http://ant.apache.org/ivy/history/latest-release/concept.html#cache
>> >>
>> >> The subtle part is that Ivy actually uses 2 caches, a resolution 
>> >> cache and a repository cache.
>> [snip]
>> > But I guess I shouldn't use ${user.home}/.ivy2/cache as
>> > *repository* cache either. Certainly some other projects 
>> will use that 
>> > too, and if they don't use lockStrategy="artifact-lock"... 
>> and I bet 
>> > most will not. Well, it's rarely a problem, as two projects 
>> had to be 
>> > built in parallel for that to be problem... but still, does it boil 
>> > down to that most projects (or company) should use it's own caches 
>> > (and not forgetting to set the *resolution* caches too)?
>> [snip]
>> 
>> To answer my above question... I now tried using separate 
>> *resolution* caches for each ivysetting.xml-s, but with the 
>> common per-user
>> *repository* cache, ${user.home}/.ivy2/cache.  As the 
>> ivysetting.xml-specific resolver names still get into 
>> ${user.home}/.ivy2/cache (yes, into the *repository* cache 
>> part of it), it can still cause "undefined resolver" errors 
>> in *other* projects that use ${user.home}/.ivy2/cache too. It 
>> doesn't cause errors in my project though, as it knows the 
>> custom resolvers.
>
> If you're getting this behavior, think you've either made an error in
> configuration or uncovered a bug.   Could you post your respective
> config files rather than describing what you did?  

I would believe that the authors are aware of this. Simply, the name
of the last resolver of an artifact is stored in the
ivydata-[revision].properties file as the "resolver" property. And
that file belongs to the repository cache, not to the resolution
cache, right?

>> OK, so to recapitulate for the mail archives (experts please 
>> correct where I'm mistaken):
>> 
>> First, note that there is *repository* cache VS *resolution* cache:
>> http://ant.apache.org/ivy/history/latest-release/concept.html#cache
>> 
>> It seems to me, the only safe solution is using a separate
>> *repository* cache for each ivysettings.xml (at least), but 
>> it's enough to associate that cache with the custom resolvers 
>> (not to the built-in resolvers like "default", "local" and 
>> like; those you can <include> in your ivysettings.xml), so 
>> the cache of the Ibiblio artifacts can still remain global. 
>> Oh, and lockStrategy="artifact-lock" should not be forgotten 
>> if the repository cache will be accessed concurrently.
>> 
>> Also, if I get it right, you should use at least one 
>> *resolution* cache per ivysettings.xml per user account, and 
>> that you better associate to each resolvers, i.e. even to the 
>> built-in ones.

The last warning is certainly needless, since certainly you can't
assign different resolution caches to different resolvers... it's a
ivysettings.xml-scope setting as far as I saw.

>> Actually I have to do it with even finer
>> granularity: I use one resolution cache per ivysettings.xml 
>> per user account per project, because two projects that use 
>> the same ivysettings.xml may be built in parallel (automated 
>> integration builds on the server).
>
> Without seeing your config files I may be missing something somewhere,
> but this seems like just a very circuitous way of specifying different
> default caches in each ivysettings file that you use.   This would
> assign both the resolution cache and repository cache uniquely in each
> settings file.  

Simply, since multiple projects use the same ivysettings.xml, and they
may be built in parallel (think about a continuos integration server),
and the resolution caches shouldn't be accessed concurrently
(according to the Ivy docs), I think I can't use just one resolution
cache per ivysettings.xml. Can I? And then I'm still lucky that the
same project is not built in two parallel processes sometimes... :)

> -----------------------------------------
> ====================================================
> This message contains PRIVILEGED and CONFIDENTIAL
> information that is intended only for use by the 
> named recipient. If you are not the named recipient,
> any disclosure, dissemination, or action based on 
> the contents of this message is prohibited. In such
> case please notify us and destroy and delete all 
> copies of this transmission.  Thank you.
> ====================================================

-- 
Best regards,
 Daniel Dekany


RE: [solved] How to prevent "unknown resolver" errors?

Posted by "Brown, Carlton" <Ca...@compucredit.com>.
 > -----Original Message-----
> From: Daniel Dekany [mailto:ddekany@freemail.hu] 
> Sent: Wednesday, March 11, 2009 5:59 PM
> To: Daniel Dekany
> Subject: Re: [solved] How to prevent "unknown resolver" errors?
> 
> Wednesday, March 11, 2009, 7:22:42 PM, Daniel Dekany wrote:
> > Wednesday, March 11, 2009, 5:26:04 PM, Brown, Carlton wrote:
> >> It's documented, although the implications are not 
> explained enough.
> >> http://ant.apache.org/ivy/history/latest-release/concept.html#cache
> >>
> >> The subtle part is that Ivy actually uses 2 caches, a resolution 
> >> cache and a repository cache.
> [snip]
> > But I guess I shouldn't use ${user.home}/.ivy2/cache as
> > *repository* cache either. Certainly some other projects 
> will use that 
> > too, and if they don't use lockStrategy="artifact-lock"... 
> and I bet 
> > most will not. Well, it's rarely a problem, as two projects 
> had to be 
> > built in parallel for that to be problem... but still, does it boil 
> > down to that most projects (or company) should use it's own caches 
> > (and not forgetting to set the *resolution* caches too)?
> [snip]
> 
> To answer my above question... I now tried using separate 
> *resolution* caches for each ivysetting.xml-s, but with the 
> common per-user
> *repository* cache, ${user.home}/.ivy2/cache.  As the 
> ivysetting.xml-specific resolver names still get into 
> ${user.home}/.ivy2/cache (yes, into the *repository* cache 
> part of it), it can still cause "undefined resolver" errors 
> in *other* projects that use ${user.home}/.ivy2/cache too. It 
> doesn't cause errors in my project though, as it knows the 
> custom resolvers.

If you're getting this behavior, think you've either made an error in
configuration or uncovered a bug.   Could you post your respective
config files rather than describing what you did?  

> OK, so to recapitulate for the mail archives (experts please 
> correct where I'm mistaken):
> 
> First, note that there is *repository* cache VS *resolution* cache:
> http://ant.apache.org/ivy/history/latest-release/concept.html#cache
> 
> It seems to me, the only safe solution is using a separate
> *repository* cache for each ivysettings.xml (at least), but 
> it's enough to associate that cache with the custom resolvers 
> (not to the built-in resolvers like "default", "local" and 
> like; those you can <include> in your ivysettings.xml), so 
> the cache of the Ibiblio artifacts can still remain global. 
> Oh, and lockStrategy="artifact-lock" should not be forgotten 
> if the repository cache will be accessed concurrently.
> 
> Also, if I get it right, you should use at least one 
> *resolution* cache per ivysettings.xml per user account, and 
> that you better associate to each resolvers, i.e. even to the 
> built-in ones. Actually I have to do it with even finer 
> granularity: I use one resolution cache per ivysettings.xml 
> per user account per project, because two projects that use 
> the same ivysettings.xml may be built in parallel (automated 
> integration builds on the server).

Without seeing your config files I may be missing something somewhere,
but this seems like just a very circuitous way of specifying different
default caches in each ivysettings file that you use.   This would
assign both the resolution cache and repository cache uniquely in each
settings file.  

-----------------------------------------
====================================================
This message contains PRIVILEGED and CONFIDENTIAL
information that is intended only for use by the 
named recipient. If you are not the named recipient,
any disclosure, dissemination, or action based on 
the contents of this message is prohibited. In such
case please notify us and destroy and delete all 
copies of this transmission.  Thank you.
====================================================