Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala SBT: scala compiler version

Tags:

scala

swing

sbt

I know that the scala swing libraries are present in scala 2.8:

[info] Building project chart 1.0 against Scala 2.8.1
[info]    using sbt.DefaultProject with sbt 0.7.4 and Scala 2.7.7

So how come I'm getting this error:

[error] /src/main/scala/Chart.scala:2: value swing is not a member of package scala
[error] import scala.swing.Panel

Is it because SBT is using the wrong version of scala (i.e. 2.7.7)? If so, how do I configure it to use the correct version?

EDIT: Answer

Following Dylan Lacey's answer, I made the following file sbt/project/build/chart.scala:

import sbt._

class SamplesProject(info: ProjectInfo) extends DefaultProject(info)
{
   val scalaSwing = "org.scala-lang" % "scala-swing" % "2.8.1"
}

Then I ran: sbt reload update from the shell.

Now things compile!

like image 937
dsg Avatar asked Feb 25 '11 03:02

dsg


1 Answers

For sbt 0.11 (and presumably 0.10) then adding the following to build.sbt will do it:

libraryDependencies <+= scalaVersion { "org.scala-lang" % "scala-swing" % _ }
like image 63
Jay Daley Avatar answered Nov 09 '22 02:11

Jay Daley