Karsten
Karsten

Reputation: 872

Scala Saddle: No class def for ScalarTag

I try to create a TimeSeries class based on saddle's Series class. I get the following error on my tests:

java.lang.NoClassDefFoundError: org/saddle/scalar/ScalarTag

My TimeSeries class:

object TimeSeries {

  def apply[V: ST](values: (LocalDate, V)*): TimeSeries[V] = {
    new TimeSeries(Series(values: _*))
  }
}

class TimeSeries[V: ST](values: Series[LocalDate, V]) { ... }

My test:

class TimeSeriesTest extends WordSpec with GivenWhenThen with ShouldMatchersForJUnit {
  "TimeSeries" when {

  val d2014_02_01 = new LocalDate(2014, 2, 1);
  val d2014_02_03 = new LocalDate(2014, 2, 3);
  val d2014_02_04 = new LocalDate(2014, 2, 4);

  "created with data points as arguments" should {
    "have the earliest point as start, the latest as the end, and a length" in {                   
      val a = TimeSeries(d2014_02_01 -> 0.6, d2014_02_03 -> 4.5, d2014_02_04 -> 0.9)

      ...
    }
  }
}

My guess is that it has to do with the context bound in the TimeSeries class. I am new to that topic. Any suggestions?

Upvotes: 0

Views: 166

Answers (1)

goozez
goozez

Reputation: 644

After adding the the LocalDate Ordering your code worked (no errors). Try using this build.sbt:

scalaVersion := "2.10.3"

resolvers ++= Seq(
    "Sonatype Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
      "Sonatype Releases" at "http://oss.sonatype.org/content/repositories/releases"
    )

libraryDependencies ++= Seq(
  "org.scalatest" % "scalatest_2.10" % "2.0" % "test",
  "org.scala-saddle" %% "saddle-core" % "1.3.+",
  "joda-time" % "joda-time" % "2.3",
  "org.joda" % "joda-convert" % "1.2",
  "com.novocode" % "junit-interface" % "0.9" % "test"
  // (OPTIONAL) "org.scala-saddle" %% "saddle-hdf5" % "1.3.+"
  )

https://github.com/goozez/saddle-skeleton

Upvotes: 1

Related Questions