Where does sbt put the downloaded jar? I\'m trying to ask sbt to download all dependencies and put them under lib/ directory so I can use them with the ScalaIDE, however aft
All new SBT versions (after 0.7.x) by default put the downloaded JARS into the .ivy2 directory in your home directory.
If you are using Linux, this is usually /home/<username>/.ivy2/cache.
If you are using Windows, this is usually c:\Users\<username>\.ivy2\cache.
EDIT:
Here's an example from one of my projects,
in which I define an SBT task that copies the dependencies into the target folder.
You can place this code into your project/Build.scala project definition file.
You should have something like this in your project definition file (more info at www.scala-sbt.org):
import sbt._
import Keys._
import Process._
object MyProjectBuild extends Build {
The following code copies all your libraries to a deploy/libz subdirectory,
by defining a deploy task that captures your program artifact and all its classpath dependencies:
val deployKey = TaskKey[Unit](
"deploy",
"Deploys the project in the `deploy` subdirectory."
)
val deployTask = deployKey <<= (artifactPath in (Compile, packageBin), dependencyClasspath in Compile) map {
(artifact, classpath) =>
val deploydir = new File("deploy")
val libzdir = new File("deploy%slib".format(File.separator))
// clean old subdirectory
deploydir.delete()
// create subdirectory structure
deploydir.mkdir()
libzdir.mkdir()
// copy deps and artifacts
val fullcp = classpath.map(_.data) :+ artifact
def lastName(file: File) = if (file.isFile) file.getName else file.getParentFile.getParentFile.getParentFile.getName
for (file <- fullcp) {
println("Copying: " + file + "; lastName: " + lastName(file))
if (file.isFile) IO.copyFile(file, (libzdir / lastName(file)).asFile);
else IO.copyDirectory(file, (libzdir / lastName(file)))
}
} dependsOn (packageBin in Compile)
The reference below is useful for sbt.
https://www.scala-sbt.org/1.x/docs/Launcher-Configuration.html
You can find sbt.ivy.home is the parameter and default is ${user.home}/.ivy2/.
...
[repositories] local typesafe-ivy-releases: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/artifact.[ext], bootOnly maven-central sonatype-snapshots: https://oss.sonatype.org/content/repositories/snapshots
[boot] directory: ${sbt.boot.directory-${sbt.global.base-${user.home}/.sbt}/boot/}
[ivy] ivy-home: ${sbt.ivy.home-${user.home}/.ivy2/}
...
I find the sbt dependency from http://mvnrepository.com/
for example, you want to find MySQL Java Connector, you can search form the search box, and choose a version you like, then you will see sbt tag:
libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.34"
if you want to find the downloaded jars, in windows is C:\Users\<userName>\.ivy2\cache
in linux is ~/.ivy2/cache
good luck