2
我需要在最簡單的scala項目中安裝一些依賴項(我正在通過一些教程),其中一個來自github。我build.sbt
看起來是這樣的:無法從github導入已安裝的scala/sbt庫依賴項
import sbt._
lazy val root = Project("root", file("."))
.dependsOn(smile)
.settings(
name := "Xyclade ML practical examples",
version := "1.0",
scalaVersion := "2.10.6",
sbtVersion := "0.13.9",
libraryDependencies += "org.scala-lang" % "scala-swing" % "2.10.2"
)
lazy val smile = ProjectRef(uri("https://github.com/haifengl/smile.git#master"), "root")
也許,我缺少一些基本的斯卡拉/ SBT知識(我是一個完整的小白),但:
1)import com.github.haifengl._
失敗object github is not a member of package com
2) import smile._
導致錯誤not found: object smile
而據我發現,庫包應該被稱爲像com.github.haifengl
:https://github.com/haifengl/smile/search?utf8=%E2%9C%93&q=com.github.haifengl&type=Code
@先生-V,這是工作,謝謝!我可以通過調用'import smile._'來導入lib。但是我不能使用它的任何類,例如'val plot = ScatterPlot ...'失敗,'找不到:值ScatterPlot'。或者我應該在斯卡拉的某個地方明確聲明這個類? –
通過'import smile.plot._'修復了這個問題(對於這種愚蠢的錯誤來說)。再次感謝! –