How to set up Ivy blocking strategy in Sbt

I need to configure an Ivy lock strategy in sbt build.

I tried putting externalIvySettings(baseDirectory(_ / "ivysettings.xml")) in Build.scala

ivysettings.xml:

 <ivysettings> <settings defaultResolver="default"/> <include url="${ivy.default.settings.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"/> <lock-strategies>no-lock</lock-strategies> </ivysettings> 

But in this case, sbt cannot resolve dependencies (I suppose because the resolvers are shielded by the resolvers from ivysettings).

How to set up a blocking strategy in Build.scala ?

+6
source share
1 answer

After spending some time, I found a solution. I copied the ivyConfiguration insert from DefaultSettings and replaced the GlobalLock parameter with None (I need to disable the lock):

 ivyConfiguration <<= (externalResolvers, ivyPaths, offline, checksums, appConfiguration, target, streams) map { (rs, paths, off, check, app, t, s) => val resCacheDir = t / "resolution-cache" new InlineIvyConfiguration(paths, rs, Nil, Nil, off, None, check, Some(resCacheDir), s.log) } 

This seems like a workaround for me, but it works. Now there is no ivy blocking. Please help me improve the solution if you know how, since I'm new to sbt.

+2
source

Source: https://habr.com/ru/post/947665/


All Articles