Is there a command in the SBT console that forces it to resolve artifacts (especially, re-resolve SNAPSHOT dependencies)? The only way I know of now is to run clean and then compile (or start), but this takes much longer and isn't always necessary.
You can mark the needed dependencies to re-check them on update:
libraryDependencies ++= {
"org.specs2" %% "specs2" % "1.10-SNAPSHOT" % "test" changing()
}
Re-download a SNAPSHOT version of a dependency using SBT
The update command should help.
From the task's documentation:
Resolves and optionally retrieves dependencies, producing a report.
See Dependency Management Flow.
What's more important, SNAPSHOT dependencies are in their nature changing() so there's no need to add anything after ModuleID to mark them as such. Every update is supposed to resolve them against the repositories.
Perhaps update-classifiers is what you are looking for? Otherwise, try the tasks command to see what's available.
Related
Scala SBT manual apparently says that there is some "lightweight alternative to Ivy" called "inline declarations"
http://www.scala-sbt.org/0.13/docs/Library-Management.html
I have a single jar file ( printer_2.11-1.0.jar ) with no dependencies or imports what so ever that I created with "sbt package". I want to get this jar to a place on the internet where I can include it into my future projects as soon as possible. I don't know how to use Ivy or Maven. Can someone give me a solution that can get my jar listed as fast as possible?
Solved:
libraryDependencies += "printer" % "printer" % "2.11" from "https://dl.dropboxusercontent.com/u/214507961/printer_2.11-1.0.jar"
^ The jar file is posted to a public dropbox folder.
You are misreading the manual. Going to section Inline Declarations. The text reads:
Inline declarations are a basic way of specifying the dependencies to be automatically retrieved. They are intended as a lightweight alternative to a full configuration using Ivy.
This is an example inline definition of a dependency:
libraryDependencies += groupID % artifactID % revision
which will be normally resolved through Ivy. The sentence does not say 'lightweight alternative to Ivy', it means:
They are intended as an Ivy based automatically resolved lightweight alternative to specifying a full configuration manually.
The latter being:
Manually managing dependencies involves copying any jars that you want to use to the lib directory.
This is the solution...
libraryDependencies += "printer" % "printer" % "2.11" from "https://dl.dropboxusercontent.com/u/214507961/printer_2.11-1.0.jar"
^ The jar file is posted to a public dropbox folder. This jar file makes print statements easier to locate.
I have an assignment to use some http client. I am planning to use scalaj-http for that. The installation page for that https://github.com/scalaj/scalaj-http, it says:
Installation
in your build.sbt
libraryDependencies += "org.scalaj" %% "scalaj-http" % "1.1.4"
But nothing is clearly mention, where do i need to do and what needs to be done? Is it command, or we have to paste this somewhere.
Can someone explain in detail?
You need to create an SBT project and add that library dependency in your build file. This link should help you to get started: http://www.scala-sbt.org/0.13/tutorial/Hello.html
in Build.scala, you can specify that a library dependency should be updated each time by using the changing method. For example:
"com.github.seratch" %% "scalikesolr" % "4.6.0" changing()
Is there a way to do a similar thing for project references to external URI. For example:
RootProject(uri("git://git#github.com/Somewhere/project.git"))
Updates don't seem to trigger the project reference to update.
This is a known issue with sbt, see: https://github.com/sbt/sbt/issues/1120
On Github there is an description how to build the framework from scratch. How ever I want to understand how somethings work internally so I want to setup the Eclipse-IDE to make this as comfortable as possible. Has anyone a description how this can be easily done?
To make it clear, I don't want to know how to setup eclipse for working on play-project.
THIS SOLUTION WAS FOR PLAY 2.0, you can't use it directly in 2.1! at least the command build-repository isn't valid anymore.
git clone git://github.com/playframework/Play20.git
Add
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.0.0")
to play20/framework/project/plugins.sbt, so you get
logLevel := Level.Warn
resolvers += Classpaths.typesafeResolver
addSbtPlugin("com.typesafe.sbtscalariform" % "sbtscalariform" % "0.3.0")
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.0.0")
Then make the normal build processes.
$ cd Play20/framework
$ ./build
> build-repository
> eclipse
Create a Scala-IDE give her enough Space, choose the 64-bit variant if you can!
Import projects from play20/framework/src
Add /Play/target/scala-2.9.1/src_managed/main as source folder.
You will end up with less than 10 compilation errors :-(, but will have the most of the code in eclipse.
When building against 2.1 snapshot, Eclipse keeps the .ivy2/cache jar of play 2.0.1, which is where, in my case the errors were coming from.
The solution is to remove play 2.0.1 jar from eclipse build path, and add in the 2.1 snapshot jar that you build (in your-play20/repository/local/play/play_2.9.1/2.1-SNAPSHOT/jars)
Got an error free Eclipse + Scala-IDE setup, nice ;-)
Take a look at the Sbt eclipse Plugin. It will generate an eclipse project for you. It should be rather easy. Just follow the instruction on the plugins git page. Regards. Jan
Just getting started with SBT, and I would like to setup it up to always get sources for dependencies it downloads. Having to add to remember to type withSources() for every dependency declared is only mildly annoying, but the real killer is the dependencies of dependencies problem.
Anybody know a simple switch to turn this on?
try this https://github.com/OlegYch/sbt-sources-plugin