Can compile with scalac, but not with sbt (CLASSPATH problem)

Some years ago I wrote a Scala program that until now worked without a hitch. It still does, but I wanted to make some cosmetic changes.
I can create the class file without problems with scalac, but when using sbt I get:
[error] /home/cecil/quotes/QTableViewExample.scala:1: object trolltech is not a member of package com
[error] import com.trolltech.qt.core._
Some years ago I wrote a Scala program that until now worked without a hitch. It still does, but I wanted to make some cosmetic changes.
I can create the class file without problems with scalac, but when using sbt I get:
[error] /home/cecil/quotes/QTableViewExample.scala:1: object trolltech is not a member of package com
[error] import com.trolltech.qt.core._

​So it looks like sbt does not use my CLASSPATH. How can I make sure that sbt uses my classpath?​
​So it looks like sbt does not use my CLASSPATH. How can I make sure that sbt uses my classpath?​

It won’t and shouldn’t, since that would mean that your build isn’t reproducible. Instead, you need to tell SBT about your dependencies explicitly. If it’s available on Maven, add the dependency to your build.sbt like this:

libraryDependencies += "group" %% "artifact" % "version" // if it's written in Scala
// or
libraryDependencies += "group" % "artifact" % "version" // if it's written in Java

For libraries that aren’t available on Maven, such as QT Jambi, create a folder called lib in your project folder and put the jars there, and SBT will add them to its classpath.

1 Like

OK, thanks.

At the moment I do not get it working. So I will just keep using fsc for the moment. When I have some time I will explore it further.