Cache configuration problem
---------------------------

                 Key: IVY-957
                 URL: https://issues.apache.org/jira/browse/IVY-957
             Project: Ivy
          Issue Type: Bug
    Affects Versions: 2.0-RC1, trunk
            Reporter: Adrian Sandor


I have this ivysettings file:

<ivysettings>
        <settings defaultResolver="private-shared"/>
        <property name="shared-path" value="/usr/local/private/ivy/shared"/>
        <property name="ivy.default.always.check.exact.revision" value="false"/>
        <resolvers>
                <sftp name="private-shared" host="server" port="22" user="ivy" 
userPassword="private" checkmodified="true">
                        <ivy 
pattern="${shared-path}/[organisation]/[module]/[revision]/[artifact].[ext]" />
                        <artifact 
pattern="${shared-path}/[organisation]/[module]/[revision]/[type]s/[artifact]-[revision].[ext]"
 />
                        <artifact 
pattern="${shared-path}/[organisation]/[module]/[revision]/[type]s/[artifact]-[revision]-[type]s.[ext]"
 />
                </sftp>
                <ibiblio name="public" m2compatible="true"/>
        </resolvers>
        <caches resolutionCacheDir="${ivy.settings.dir}/cache/resolution"
                repositoryCacheDir="${ivy.settings.dir}/cache/repository"/>
</ivysettings>

And I'm calling ivy:resolve from an ant build script (with -v). I get these 
messages (among others):

no default cache defined: set to /home/aditsu/.ivy2/cache
        default cache: /home/aditsu/.ivy2/cache

So it downloads the files to that location instead of the one I specified.
If I delete the .ivy2 directory and create a file instead, retrieve fails. 

I debugged it and found that it sets the correct location first:
[ivy:resolve] at 
org.apache.ivy.core.cache.DefaultRepositoryCacheManager.setBasedir(DefaultRepositoryCacheManager.java:163)
[ivy:resolve] at 
org.apache.ivy.core.cache.DefaultRepositoryCacheManager.<init>(DefaultRepositoryCacheManager.java:109)
[ivy:resolve] at 
org.apache.ivy.core.settings.IvySettings.getDefaultRepositoryCacheManager(IvySettings.java:1205)
[ivy:resolve] at 
org.apache.ivy.plugins.resolver.AbstractResolver.initRepositoryCacheManagerFromSettings(AbstractResolver.java:374)
[ivy:resolve] at 
org.apache.ivy.plugins.resolver.AbstractResolver.validate(AbstractResolver.java:408)
[ivy:resolve] at 
org.apache.ivy.core.settings.IvySettings.validateAll(IvySettings.java:1447)
[ivy:resolve] at 
org.apache.ivy.core.settings.IvySettings.validate(IvySettings.java:1424)
[ivy:resolve] at 
org.apache.ivy.core.settings.XmlSettingsParser.doParse(XmlSettingsParser.java:160)
[ivy:resolve] at 
org.apache.ivy.core.settings.XmlSettingsParser.parse(XmlSettingsParser.java:149)
[ivy:resolve] at 
org.apache.ivy.core.settings.IvySettings.load(IvySettings.java:377)
[ivy:resolve] at org.apache.ivy.Ivy.configure(Ivy.java:411)

Then it overwrites it with the wrong one:
[ivy:resolve] at 
org.apache.ivy.core.cache.DefaultRepositoryCacheManager.setBasedir(DefaultRepositoryCacheManager.java:163)
[ivy:resolve] at 
org.apache.ivy.core.settings.IvySettings.setDefaultCache(IvySettings.java:712)
[ivy:resolve] at 
org.apache.ivy.core.settings.IvySettings.getDefaultCache(IvySettings.java:792)
[ivy:resolve] at 
org.apache.ivy.core.settings.IvySettings.dumpSettings(IvySettings.java:505)
[ivy:resolve] at 
org.apache.ivy.core.settings.IvySettings.load(IvySettings.java:386)
[ivy:resolve] at org.apache.ivy.Ivy.configure(Ivy.java:411)

I also found a workaround: I added defaultCacheDir="/dev/null" to the caches 
tag and it works now.
This doesn't agree with the documentation: "we recommend setting both the 
resolutionCacheDir and repositoryCacheDir attributes on this tag *instead of* 
using defaultCacheDir"


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to