[ 
https://issues.apache.org/jira/browse/IVY-568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12511370
 ] 

Xavier Hanin commented on IVY-568:
----------------------------------

This is indeed a documentation and error handling issue. Macrodef is not 
supposed to work with several resolvers. But you can define a chain in with 
your macrodef, and it should work properly.

So the fix for this issue is to add better documentation for macrodef, and 
raise an error when someone tries to do what you did.

> macrodef of a set of resolvers only remembers the last one
> ----------------------------------------------------------
>
>                 Key: IVY-568
>                 URL: https://issues.apache.org/jira/browse/IVY-568
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-alpha-1
>            Reporter: Jing Xue
>            Priority: Minor
>
> I have ivysettings like this:
> {code:xml}
> <ivysettings>
>   <properties file="build.properties" override="true" />
>   <property name="ivyx.returnFirst" value="true" override="false" />
>   <property name="ivyx.defaultResolver" value="main" override="false" />
>   <settings defaultResolver="${ivyx.defaultResolver}" checkUpToDate="true" />
>   <macrodef name="cacheless-chain">
>     <filesystem name="local" m2compatible="true" local="true">
>       <ivy 
> pattern="${local.ivy.repo.root}/[organisation]/[module]/[revision]/ivy-[revision](-[classifier]).xml"/>
>       <artifact 
> pattern="${local.ivy.repo.root}/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
>     </filesystem>
>     <filesystem name="local-m2" m2compatible="true" local="true">
>       <ivy 
> pattern="${local.m2.repo.root}/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).pom"/>
>       <artifact 
> pattern="${local.m2.repo.root}/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
>     </filesystem>
>     <ibiblio name="ibiblio" m2compatible="true" 
> root="${ivyx.ibiblio.artifact.root}" checksums=""
>              alwaysCheckExactRevision="false" />
>   </macrodef>
>   <resolvers>
>     <chain name="main" returnFirst="${ivyx.returnFirst}">
>       <cache name="cacheResolver" />
>       <cacheless-chain name="cacheless-chain-1" />
>     </chain>
>     <!--
>     "Cacheless" only means the CacheResolver doesn't get involved,
>     but doesn't mean the cache is skipped completely. Ivy still copies
>     the stuff it resolved into the cache.
>     -->
>     <chain name="main-cacheless" returnFirst="${ivyx.returnFirst}">
>       <cacheless-chain name="cacheless-chain-2" />
>     </chain>
>   </resolvers>
> </ivysettings>
> {code}
> When I try to use the 'main-cacheless' resolver by "ant -v 
> -Divyx.defaultResolver=main-cacheless", the two local repos defined in the 
> macro are completely ignored during ivy:resolve, as shown by the verbose log:
> {quote}
> [ivy:resolve] settings loaded (264ms)
> [ivy:resolve]   default cache: /home/jingxue/.ivy/cache
> [ivy:resolve]   default resolver: main-cacheless
> [ivy:resolve]   -- 5 resolvers:
> [ivy:resolve]   cacheResolver [cache]
> [ivy:resolve]   cacheless-chain-2-ibiblio [ibiblio]
> [ivy:resolve]   main-cacheless [chain] [cacheless-chain-2-ibiblio]
> [ivy:resolve]   cacheless-chain-1-ibiblio [ibiblio]
> [ivy:resolve]   main [chain] [cacheResolver, cacheless-chain-1-ibiblio]
> {quote}
> (I realize this could be just a documentation issue - maybe a macrodef isn't 
> supposed to contain more than one resolver?)

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