Aroon Aroon - 4 months ago 54
Scala Question

How to write the "import" , "import" libraries in SBT

I am compiling the Scala program using the SBT but It gives me following error for "import" , "import"

sbt.ResolveException: unresolved dependency:;latest.integration: not found
[error] unresolved dependency:;latest.integration: not found

My SBT format is given below:

name := "Simple Project"

version := "1.0"

scalaVersion := "2.11.7"

libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-graphx" % "2.0.1",
"org.scala" %% "" % "latest.integration",
"" %% "" % "latest.integration"

Anybody can help that how i can specify the "import" , "import" in SBT.


One needs to make a distinction between library dependencies and package imports: library dependencies are managed through the build system (like sbt or maven or grails,...) and make complete libraries (like a logging API, HTTP implementation, ...) available to the system being built.

At the program level, imports are used to bring specific parts of libraries into the scope of the code being developed.

Given this build.sbt

name := "examplebuild"

version := "0.0.1"

scalaVersion := "2.11.7"

libraryDependencies ++= Seq(
  "com.typesafe" % "config" % "1.2.1",
  "org.scalaj" % "scalaj-http_2.11" % "2.3.0"

We can develop a scala program that can use the configuration library from typesafe and the http library from scalaj


package com.example

import  // from the Scala standard library
import  // import all io package from the standard java library

import com.typesafe.ConfigFactory // from the typesafe config library
import scalaj.http._  // import all members of the scalaj.http package

class Sample {
   // code here