ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Laun <tho...@launweb.de>
Subject Re: Re: sorting or ordering of resolved jars
Date Fri, 22 May 2009 08:41:26 GMT
Hello Rob,

you could try to use different configurations for that purpose. The 
patches are downloaded in one configuration, and your enhancements are 
downloaded in another configuration. Retrieve each configuration to a 
separate directory and build the classpath by scanning the directories 
in the correct order.

Your ivy.xml would look something like this:

<configurations>
   <configuration name="patches" description="contains vendor patches"/>
   <configuration name="enhancements" description="contains own 
enhancements"/>
   [...]
</configurations>
<dependencies>
   <dependency org="vendor1" name="patches" conf="patches->@" />
   <dependency org="myco" name="myenhancements" conf="enhancements->@" />
   <dependency org="vendor1" name="core-app" 
conf="*,!patches,!enhancements->@" />
<dependencies>

The easiest setupt would be to retrieve each configuration into a 
separate directory. Then you can build your classpath by simply using 
all files in the folders:

<path id="myClasspath">
  <fileset dir="lib/patches" includes="*"/>
  <fileset dir="lib/enhancements" include="*"/>
  <fileset dir="lib/default" include="*"/>
</path>

As an alternative, you could use the ivy:cachpath task. It allows you to 
build a path of all artifacts in a configuration.

Thomas


rob08 wrote:
> Geoff Clitheroe-2 wrote:
>   
>> Hi Rob,
>>
>> I'm not sure that the shadowing is easy to deal with in pure Ivy
>> (unless the vendor is providing Ivy files with nice configs or you
>> write your own).  You could look at latest strategies and conflict
>> resolution
>>
>> http://ant.apache.org/ivy/history/2.1.0-rc1/settings/latest-strategies.html
>> http://ant.apache.org/ivy/history/2.1.0-rc1/settings/conflict-managers.html
>>
>> But if there are no configs available for you to work from then it may
>> be simplest to deal with how you set up the classpath in ant with
>> different pathelements?
>>
>> Cheers,
>> Geoff
>>     
> Thanks Geoff,
>
> I reviewed those links, but I don't think that's quite what I'm after...
>
> Here as sample fragment of my ivy.xml:
> 	<dependencies>
> 		<dependency org="vendor1" name="patches" rev="latest.integration"
> conf="*->@"/>
> 		<dependency org="myco" name="myenhancements" rev="latest.integration"
> conf="*->@"/>
> 		<dependency org="vendor1" name="core-app" rev="latest.integration"
> conf="*->@"/>
> 	</dependencies>
>
> I find that for the classpath generated by the above, the order of jars is
> random.  I have 3 configurations and the CLASSPATH generated by Ivy for each
> configuration is different.
>
> I was hoping the CLASSPATH jars could be in the same order as the
> dependencies, or perhaps a dependency attribute existed that allowed me to
> specify some sort of classpath sort order or priority.
>
> I realise that having an application depend on classpath order is a *bad
> thing*, but surely it's not unheard of in the real world, is it?  Anyway, in
> this case it's out of my hands - vendor app.
>
> Thanks,
>
>   

Mime
View raw message