如何在Sbt中配置Ivy的锁定策略 [英] How to configure Ivy's lock strategy in Sbt
问题描述
我需要在sbt构建中配置常春藤锁定策略.
I need to configure Ivy lock strategy in sbt build.
我试图将externalIvySettings(baseDirectory(_ / "ivysettings.xml"))
放入Build.scala
ivysettings.xml:
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>
但是在这种情况下,sbt无法解析依赖关系(我想是因为解析器被ivysettings屏蔽了).
But in this case sbt cannot resolve dependencies(I suppose because resolvers are shielded by resolvers from ivysettings).
如何在Build.scala
中配置锁定策略?
How can I configure lock strategy in Build.scala
?
推荐答案
花了一些时间后,我找到了解决方案.我从defaultSettings复制粘贴了ivyConfiguration并将GlobalLock参数替换为None(我需要禁用锁定):
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)
}
对我来说,这似乎是一种解决方法,但它可以工作.现在没有常春藤锁. 如果您知道如何,请帮助我改善解决方案,因为我是sbt的新手.
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.
这篇关于如何在Sbt中配置Ivy的锁定策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!