gpt4 book ai didi

scala - 即使在增量编译中,SBT 1.3.8 也会自动更新 SNAPSHOT 版本

转载 作者:行者123 更新时间:2023-12-03 21:58:55 27 4
gpt4 key购买 nike

从 SBT 1.3.0 开始,Coursier 是默认解析器引擎,因此我们从依赖项中删除了 Coursier SBT 插件。

在 Coursier-plugin 时代,我们使用了 COURSIER_TTL="5 min"控制频率 SNAPSHOT版本应该自动获取,即​​使是在 sbt ~test:compile 时在开发过程中使用。

对于依赖项 SNAPSHOT项目,这里是输出:

sbt:hub> show isSnapshot
[info] common / isSnapshot
[info] true
[info] isSnapshot
[info] true
sbt:hub> show packagedArtifacts
[info] Wrote C:\Users\Ehnalis\Projects\hub\common\target\scala-2.12\common_2.12-0.5.0-SN
APSHOT.pom
[info] Wrote C:\Users\Ehnalis\Projects\hub\target\scala-2.12\hub_2.12-0.5.0-SNAPSHOT.pom

[info] common / packagedArtifacts
[info] Map(Artifact(common, jar, jar, None, Vector(compile), None, Map(), None, false)
-> C:\Users\Ehnalis\Projects\hub\common\target\scala-2.12\common_2.12-0.5.0-SNAPSHOT.jar
, Artifact(common, src, jar, Some(tests-sources), Vector(test), None, Map(), None, false
) -> C:\Users\Ehnalis\Projects\hub\common\target\scala-2.12\common_2.12-0.5.0-SNAPSHOT-t
ests-sources.jar, Artifact(common, jar, jar, Some(tests), Vector(test), None, Map(), Non
e, false) -> C:\Users\Ehnalis\Projects\hub\common\target\scala-2.12\common_2.12-0.5.0-SN
APSHOT-tests.jar, Artifact(common, src, jar, Some(sources), Vector(compile), None, Map()
, None, false) -> C:\Users\Ehnalis\Projects\hub\common\target\scala-2.12\common_2.12-0.5
.0-SNAPSHOT-sources.jar, Artifact(common, pom, pom, None, Vector(pom), None, Map(), None
, false) -> C:\Users\Ehnalis\Projects\hub\common\target\scala-2.12\common_2.12-0.5.0-SNA
PSHOT.pom)
[info] packagedArtifacts
[info] Map(Artifact(hub, src, jar, Some(sources), Vector(compile), None, Map(), None, f
alse) -> C:\Users\Ehnalis\Projects\hub\target\scala-2.12\hub_2.12-0.5.0-SNAPSHOT-sources
.jar, Artifact(hub, jar, jar, Some(tests), Vector(test), None, Map(), None, false) -> C:
\Users\Ehnalis\Projects\hub\target\scala-2.12\hub_2.12-0.5.0-SNAPSHOT-tests.jar, Artifac
t(hub, jar, jar, None, Vector(compile), None, Map(), None, false) -> C:\Users\Ehnalis\Pr
ojects\hub\target\scala-2.12\hub_2.12-0.5.0-SNAPSHOT.jar, Artifact(hub, src, jar, Some(t
ests-sources), Vector(test), None, Map(), None, false) -> C:\Users\Ehnalis\Projects\hub\
target\scala-2.12\hub_2.12-0.5.0-SNAPSHOT-tests-sources.jar, Artifact(hub, pom, pom, Non
e, Vector(pom), None, Map(), None, false) -> C:\Users\Ehnalis\Projects\hub\target\scala-
2.12\hub_2.12-0.5.0-SNAPSHOT.pom)

hub\common_2.12\0.5.0-SNAPSHOT 下有一个 CHECKED 文件在本地 .coursier目录,并且在另一个依赖于 hub 的项目中更改代码时不会更新, 同时使用 ~test:compile .
COURSIER_TTL在 1.3.8 中没有影响。有没有其他方法可以设置 SBT 经常检查新的 SNAPSHOT版本?

最佳答案

尝试设置 forceUpdatePeriod 持续时间 build.sbt

forceUpdatePeriod := Some(5 minutes)

哪个控制
Duration after which to force a full update to occur

因为根据 docs运行 update应该解决 SNAPSHOT 的问题

Run update explicitly. This will typically fix problems with out of date SNAPSHOTs or locally published artifacts.



编辑:尝试更新到 sbt 1.3.9哪一个

Updates to lm-coursier-shaded 2.0.0-RC6-2



哪里 2.0.0-RC6-2公开 TTL 配置

One can now adjust the TTL, the verbosity level, the checksums, and the cache policies via CoursierConfiguration, accessible via csrConfiguration in sbt.



因此尝试在 build.sbt 中设置
import scala.concurrent.duration.DurationInt
import lmcoursier.definitions.CachePolicy

csrConfiguration := csrConfiguration.value
.withTtl(1.minute)
.withCachePolicies(Vector(CachePolicy.LocalOnly))

关于scala - 即使在增量编译中,SBT 1.3.8 也会自动更新 SNAPSHOT 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60723139/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com