Hello,

Our support libraries are published with the following pattern (note these aren't ivy patterns): [module-name]-[version]_[buildnumber]. The version number is 2-3 digits -- therefore a typical publication may be "core-1.2_34", "core-1.2.1_1", etc. In each case, the revision label registered with Ivy is "1.2_34", "1.2.1_1", and so forth.

The trouble I experienced was that Ivy would consider 1.2_34 to be later than 1.2.1_1. Therefore, 1.2.1_1 would be evicted over 1.2_34. I understood why this was -- Ivy treats the underscore characters as periods. (I cursed the day I agreed to have module versions as "1.2" instead of "1.2.0".)

First of all, if you have a way to handle the above scenerio without defining a custom latest strategy, let me know. As it was, I got started developing one to handle our version-label strategy. I implemented LatestStrategy in my class. It differs in one respect from the latest-revision strategy -- should it find the pattern (for example) 1.2_34, it simply inserts the ".0" appropriately (so it ends up comparing 1.2.0_34). My unit tests passed and I was pleased with myself.

The headaches began when I was trying to change our ivy configuration to use it. I've got it registered OK, I've the <latest-strategies> and <conflict-managers> nodes defined. I've a <module> tag, attached to our organization, which specifies the custom conflict manager to use. Appropriate resolvers have the "latest" attribute pointed to our custom strategy.

Despite all of this, Ivy seems to use the default "latest-revision" conflict manager to determine which of our modules to evict. Generating the ivy HTML report, nowhere is my conflict manager even referenced. The only way I can get my custom conflict manager to work is if I define the "defaultLatestStrategy" attribute on the <conf> tag. It also works if I define the defaultConflictManager. However, I don't want to interfere with 3rd party conflict handling, so I'm hesitant to pursue that as a solution.

It just doesn't seem as if the conflict-manager for my <module> is being honored.

Am I missing something, or is this a bug in Ivy? I've included our ivyconf below (I've changed some things for proprietary obfuscation, and removed property definitions for brevity).

Thanks for your help.

Kind regards,

Keith Collison

<ivyconf>
<property name="ivy.properties.file.path" value="${ivy.conf.dir}/ivyconf-file.properties"
             override="false"/>
   <property name="ivy.default.resolver" value="default" override="false"/>

<conf defaultCache="${ivy.default.ivy.user.dir}/cache" defaultResolver="${ivy.default.resolver}"/>
   <resolvers>
       <chain name="my-chain" latest="my-latest">
               <url name="web-staging">
<ivy pattern="${my.staging.url}/${my.staging.ivy.pattern}"/> <artifact pattern="${my.staging.url}/${my.staging.artifact.pattern}"/>
               </url>
               <url name="web-shared">
<ivy pattern="${my.shared.url}/${my.shared.ivy.pattern}"/> <artifact pattern="${my.shared.url}/${my.shared.artifact.pattern}"/>
               </url>
       </chain>

       <chain name="thirdparty-chain" returnFirst="true">
           <url name="web-thirdparty">
<ivy pattern="${my.thirdparty.url}/${my.thirdparty.ivy.pattern}"/> <artifact pattern="${my.thirdparty.url}/${my.thirdparty.artifact.pattern}"/>
           </url>
           <ivyrep name="ivyrep"/>
       </chain>
       <chain name="default">
           <resolver ref="thirdparty-chain"/>
       </chain>
   </resolvers>

   <typedef name="my-latest-strategy" classname="com.mylatest.MyLatest"/>
   <latest-strategies>
       <my-latest-strategy name="my-latest"/>

   </latest-strategies>
   <conflict-managers>
       <latest-cm name="my-revision" latest="my-latest"/>
   </conflict-managers>

   <modules>
<module organisation="myorganization" matcher="regexp" conflict-manager="my-revision" name=".*" resolver="my-chain"/>
   </modules>
</ivyconf>



Reply via email to