user278530
user278530

Reputation: 83

Scala IDE can't resolve dependeices

I'm using the Scala IDE and I have the following build.sbt:

name := "hello"

version := "1.0"

scalaVersion := "2.9.1"

libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.3.2"

My class is:

object TextSplitter {

  def splitHalf(inputString: String) = {

      StringUtils.isEmpty(inputString)
  }
}

Eclipse can't resolve the dependency for StringUtils. In fact, I keep having problems with Eclipse/SBT to import anything outside the scala.* package.

I'm new to Scala, just want to try it out by building an actual example, but looks like I can't. Any idea how to resolve this?

Thanks

Upvotes: 2

Views: 1074

Answers (1)

lmm
lmm

Reputation: 17431

Eclipse doesn't integrate directly with sbt. You could manually add the dependencies to your eclipse build path, or you could use sbteclipse to generate eclipse project files with the correct dependencies based on your build.sbt.

Personally I would use maven (with the scala maven plugin) rather than sbt, since eclipse does integrate with maven (using m2eclipse and m2eclipse-scala), and will update dependencies based on your pom.xml without needing an external step to generate the correct project files.

Upvotes: 3

Related Questions