Reputation: 5376
Since SBT 1.3.0, Coursier is the default resolver engine, therefore we removed the Coursier SBT plugin from the dependencies.
In the Coursier-plugin times, we used COURSIER_TTL="5 min"
to control how frequently SNAPSHOT
version should be fetched automatically, even, when sbt ~test:compile
is used during development.
For the dependency SNAPSHOT
project, here is the output of:
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)
There is a CHECKED file under hub\common_2.12\0.5.0-SNAPSHOT
in local .coursier
directory and that would not update while code is changing in another project that depends on hub
, while using ~test:compile
.
COURSIER_TTL
has not effect in 1.3.8. Is there any other way to setup SBT to frequently check for new SNAPSHOT
versions?
Upvotes: 4
Views: 1269
Reputation: 48420
Try setting forceUpdatePeriod
duration in build.sbt
forceUpdatePeriod := Some(5 minutes)
which controls
Duration after which to force a full update to occur
because according to docs running update
should fix problems with SNAPSHOTs
Run update explicitly. This will typically fix problems with out of date SNAPSHOTs or locally published artifacts.
EDIT: Try updating to sbt 1.3.9 which
Updates to lm-coursier-shaded 2.0.0-RC6-2
where 2.0.0-RC6-2 exposes TTL configuration
One can now adjust the TTL, the verbosity level, the checksums, and the cache policies via CoursierConfiguration, accessible via csrConfiguration in sbt.
Hence try setting in build.sbt
import scala.concurrent.duration.DurationInt
import lmcoursier.definitions.CachePolicy
csrConfiguration := csrConfiguration.value
.withTtl(1.minute)
.withCachePolicies(Vector(CachePolicy.LocalOnly))
Upvotes: 5