Re-download a SNAPSHOT version of a dependency using SBT
Asked Answered
N

1

30

I have the following lines in my build.sbt file.

resolvers += "specs2 snapshot repo" at "http://scala-tools.org/repo-snapshots"

libraryDependencies += "org.specs2" %% "specs2" % "1.7-SNAPSHOT" % "test"

Now if the snapshot has changed (is this reasonable at all, that a maven SNAPSHOT version changes without its version number changing?), how can I tell sbt to download the new version? Using update does nothing.

Nyeman answered 22/11, 2011 at 9:55 Comment(0)
R
56

you should try :

libraryDependencies += "org.specs2" %% "specs2" % "1.7-SNAPSHOT" % "test" changing()

changing() will specify that the dependency can change and that it ivy must download it on each update.

Maybe you could also try to define your repository using ivyXML. Something like this :

ivyXML :=
  <resolvers>
        <ibiblio name="specs2 snapshot repo" changingPattern="*-SNAPSHOT" m2compatible="true" root="http://scala-tools.org/repo-snapshots"/>
  </resolvers>

Hope this will help.

Rampart answered 22/11, 2011 at 11:25 Comment(4)
I expected that this option doesn't have to be specified but can be infered from the SNAPSHOT string. Will sbt/ivy only check the checksums and don't download again if the jar has not changed?Nyeman
Ivy defines a matchingPattern that you can use when defining a resolver. This matchingPattern gives you the ability to define a pattern (for example "*-SNAPSHOT") for artefacts that will eventually change over the time. You should try to define a resolver with this attribute using ivyXML setting, maybe SBT will consider it.Rampart
In 0.12.1 at least, you don't need to specify changing: scala-sbt.org/release/docs/Detailed-Topics/… the last line: "There is no need to mark SNAPSHOT dependencies as changing() because sbt configures Ivy to know this already."Balladeer
Does specifying a wildcard directly in the Ivy spec work? "org.specs2" %% "specs2" % "*-SNAPSHOT" % "test"Allegiance

© 2022 - 2024 — McMap. All rights reserved.