Here’s how I fixed the ivy cache issue with Jenkins:

In my ivysettings.xml:

<ivysettings>
    <property name="env.EXECUTOR_NUMBER" value="0" override="false"/>
    <caches
        
defaultCacheDir="${ivy.default.ivy.user.dir}/cache-${env.EXECUTOR_NUMBER}"
        resolutionCacheDir="${ivy.dir}/../target/ivy.cache"/>
    <settings defaultResolver="default"/>
    <include file="${ivy.dir}/ivysettings-public.xml"/>
    <include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/>
    <include url="${ivy.default.settings.dir}/ivysettings-local.xml"/>
    <include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/>
    <include url="${ivy.default.settings.dir}/ivysettings-default-chain.xml"/>
</ivysettings>

Jenkins sets the “EXECUTOR_NUMBER” environment variable depending on which 
executor is used. If the build is run locally, the default cache will be  
$HOME/.ivy2/cache-0.

I ran into this cache issue because we clean out the cache from our locally 
built jars with each build. This guarantees we’re working with the latest 
version of those jars (something that Ivy didn’t always do all the time). 
Deleting jars while an Ivy build is running doesn’t make Jenkins very happy. It 
took us a while to realize why builds were failing.

--
David Weintraub
qazw...@gmail.com

perl -e 'print "Just another second rate Perl Hacker\n";'

> On Apr 7, 2015, at 9:58 AM, Roberto C. Sánchez <robe...@connexer.com> wrote:
> 
> On Tue, Apr 07, 2015 at 09:53:08AM +0200, Geißler, Daniel wrote:
>> Hi Roberto,
>> 
>> did you have a look into locking strategies, as far as i know ivy does no 
>> locking by default wich may lead to your problems:
>> 
>> http://ant.apache.org/ivy/history/latest-milestone/settings/lock-strategies.html
>> 
> Hi Daniel,
> 
> Thank you for responding.  This appears to be a low traffic list :-)
> 
> I did not realize that multiple builds sharing the cache could present a
> problem.  In any event, each of my builds is configured to use its own
> Ivy cache directory based on the Jenkins workspace directory.  I don't
> think that affects the part of the build with which I am currently
> experiencing a problem.  Additionally, the documentation link you
> provided does not give an example of how I would use the locking
> strategy.
> 
> I think that the problem has something to do with the deliver/publish
> logic, but I cannot seem to figure out precisely what or where.  I have
> not observed any problem with any of my downloaded artifacts for the
> dependencies.  I have only seen a problem with the delivered/published
> ivy.xml pertaining to the project being built at the same time as it is
> being built by another process (but on a different branch).
> 
> Regards,
> 
> -Roberto
> -- 
> Roberto C. Sánchez
> http://people.connexer.com/~roberto
> http://www.connexer.com

Reply via email to