Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Re-download a SNAPSHOT version of a dependency using SBT

Tags:

scala

sbt

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.

like image 209
ziggystar Avatar asked Nov 22 '11 09:11

ziggystar


People also ask

What is snapshot dependency?

In Maven, a SNAPSHOT version is a version of the project/dependency that has not been released. This is indicated by suffixing SNAPSHOT to the version number. Here's an example: <version>1.0-SNAPSHOT</version> Copy.

Where are dependencies downloaded in sbt?

unmanaged dependencies are jars dropped into the lib directory. managed dependencies are configured in the build definition and downloaded automatically from repositories.

What are resolvers in sbt?

sbt resolver is the configuration for repository that contains jars and their dependencies. for example the below is a resolver definition for a repository called Sonatype and it points at snapshot releases (dev versions) resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

What does sbt reload do?

object Reload extends CancelWatch with Product with Serializable. Action that indicates that the watch should pause while the build is reloaded. This is used to automatically reload the project when the build files (e.g. build. sbt) are changed.


1 Answers

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.

like image 88
David Avatar answered Sep 19 '22 00:09

David