Future-proofing a Scala/SBT project -
i trying use scala-graph , scala-swing in same program. can use latest graph-core library (1.9.2) alone latest version of scala (2.11.6). can use scala-swing, when that, sbt gives me scala 2.10.4 rather 2.11.6.
when tried use both libraries, got errors -- either compilation or runtime errors, depending on how set build.sbt. tried using older version of graph-core (1.8.0), if understand library's release history [1] correctly, designed scala 2.10.
doing works, although causes sbt use scala 2.10.4 instead of 2.11.6. i'm worried because seems fragile arrangement.
will keep working? build.sbt file (below) not restrict scalaversion or scala-compiler version; says graph , swing libraries use. i'm afraid changes graph library, or swing library, or scala language itself, break code.
[the rest of post describes os, installations, , code; might not need read it.]
i using ubuntu 14.04. installed scala , sbt using apt-get. swing appears installed on machine. did not install graph library sbt seems take care of it.
my 2 files in same folder: build.sbt , main.scala. build.sbt looks this:
lazy val root = (project in file(".")). settings( name := "main", version := "1.0", librarydependencies += "org.scala-lang" % "scala-swing" % "2.10.5", librarydependencies += "com.assembla.scala-incubator" %% "graph-core" % "1.8.0" )
main.scala looks this:
import scalax.collection.graph // or scalax.collection.mutable.graph import scalax.collection.graphpredef._, scalax.collection.graphedge._ import scala.swing._, scala.swing.event._ object app extends simpleswingapplication { def top = new mainframe { val g1 = graph(3~1, 5) // no effect; tests constructor val button = new button { text = "click me" } contents = new boxpanel(orientation.vertical) { contents += button border = swing.emptyborder(30, 30, 10, 30) } } }
thanks.
first, need use "org.scala-lang.modules" %% "scala-swing" % "1.0.1"
2.11.
i'm afraid changes graph library, or swing library, or scala language itself, break code.
since have specific fixed versions of both libraries, release of new versions can't affect it; recommend including scalaversion
anyway. note in particular effect of %%
depends on scalaversion
is.