How to configure Ivy's lock strategy in Sbt

谁都会走 提交于 2019-12-10 13:07:22

问题


I need to configure Ivy lock strategy in sbt build.

I tried to place 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 resolvers are shielded by resolvers from ivysettings).

How can I configure lock strategy in Build.scala ?


回答1:


After spending some time around I found the solution. I copy-pasted ivyConfiguration from defaultSettings and replaced GlobalLock parameter with None (I need to disable 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)
      }

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



来源:https://stackoverflow.com/questions/17194604/how-to-configure-ivys-lock-strategy-in-sbt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!