getting error message: "unknown resolver XYZ"
Asked Answered
F

2

17

while resolving my ivy.xml, I get a long list of errors, all stating "unknown resolver XYZ". I know the resolver, it is used in the same project but different task. As far as I understand, the resolver used to create the cache entry is stored and than cannot be determined by the follow-up resolver.

Question is: how can I avoid this? Seeams like this is not really an error, more like a warning since I am able to resolve all dependencies and continue compiling.

Fabian answered 28/2, 2011 at 16:47 Comment(0)
C
18

Within the same project, the build resolver will not change because it's defined in your ivysettings.xml file.

This is more likely to be a problem with a stale ivy cache. I'd suggest adding an extra target that purges your cache. Useful when encountering this type of problem:

<target name="clean-all" depends="clean" description="Purge ivy cache">
    <ivy:cleancache/>
</target>
Chimene answered 28/2, 2011 at 19:13 Comment(4)
That's not correct, the resolver can easily change. I may define several resolvers and configure them via the module tag. Or just use more than one settings file and refer to them via the settingsref attribute.Fabian
Yes of course you can. My point is that the ivy cache records a lot of resolver related information. It has been my experience that this cache needs to be periodically purged, especially when I change the ivy settings.Damar
finally acknowledged this answer, cleaning the cache works for me. Although I am cleaning almost everytime, so this is still far from optimal.Fabian
Worked for me. Used to had a bunch of those and now have a few of 'unknown resolver null".Dy
A
3

Run your ant build with the verbose flag (-v). This will give you clear insight into which settings files are being used throughout the resolve process. My wager is you will find your problem fairly easily and it will be along the lines of the settings file you thought you were using is actually not being used.

In my projects, I find this type of thing often happens when a post-resolve task (such as retrieve) triggers a resolve "automatically" and uses the default ivy settings instead of the one I want it to use at the moment. Chances are, your default settings file does not contain the resolvers you're expecting.

To solve these issues, I make a ivysettings-common.xml containing only resolvers. Then, in each of my settings files, I import the common settings and reference the resolvers in the main chain. That looks like:

<ivysettings>
    <settings defaultResolver="all-repositories" />
    <include file="ivysettings-common.xml" />
    <resolvers>
        <chain name="all-repositories" returnFirst="true" >
               <resolver ref="project" />
               <resolver ref="local" />
               <resolver ref="hibernate" />
               <resolver ref="ibibilo" />
        </chain>        
    </resolvers>
</ivysettings>

From there, I make the common file my default settings, just "in case of emergency" I know all my resolvers can be found (by adding the following to ivy.properties):

ivy.settings.file  = ${basedir}/path/to/ivysettings-common.xml

but I explicitly point all my ivy calls to the appropriate settings file, trying to never rely on the default because the whole reason I use ivy+ant is that I prefer precise control over my build process:

I hope all that helps you or someone else.

~gMale

Abuttals answered 15/3, 2011 at 15:22 Comment(1)
That looks promising, I will give it a try tomorrow.Fabian

© 2022 - 2024 — McMap. All rights reserved.