即使我在build.sbt中添加了依赖项,也无法使用breeze

时间:2016-11-08 00:00:04

标签: scala scala-breeze

我正在关注安装微风的this教程,但我无法让它发挥作用。

我的目录结构:

myproject/
  build.sbt
  project/
    Build.scala # This is empty
  src/ 
    main/
      scala/
        hello.scala
    test/
      scala/
        my_tests.scala

我的build.sbt看起来像这样(它主要是从教程中复制的):

name := "My project"

libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.0"

libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test"

libraryDependencies  ++= Seq(
  // other dependencies here
  "org.scalanlp" %% "breeze" % "0.12",
  // native libraries are not included by default. add this if you want them (as of 0.7)
  // native libraries greatly improve performance, but increase jar sizes.
  // It also packages various blas implementations, which have licenses that may or may not
  // be compatible with the Apache License. No GPL code, as best I know.
  "org.scalanlp" %% "breeze-natives" % "0.12",
  // the visualization library is distributed separately as well.
  // It depends on LGPL code.
  "org.scalanlp" %% "breeze-viz" % "0.12"
)

resolvers ++= Seq(
  // other resolvers here
  // if you want to use snapshot builds (currently 0.12-SNAPSHOT), use this.
  "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/",
  "Sonatype Releases" at "https://oss.sonatype.org/content/repositories/releases/"
)

// or 2.11.5
scalaVersion := "2.11.8"

我的hello.scala文件如下所示:

package mypackage

import breeze.linalg._

object Hello {

    def main(args: Array[String]): Unit = {
        println("Hello World")

        val x = Dense.Vector.zeros[Double](5)
        println(x)
    }
}

我得到的错误如下:

         not found: value Dense
[error]         val x = Dense.Vector.zeros[Double](5)
[error]                 ^

            ^

我知道我正确地将单元测试相关库添加到libraryDependencies,因为我添加它们后我的单元测试工作正常。但是在为breeze添加依赖项时我做错了什么?我应采取哪些措施来缩小问题范围?

0 个答案:

没有答案