簡體   English   中英

無法從 github 導入已安裝的 scala/sbt 庫依賴項

[英]Can't import installed scala/sbt library dependency from github

我需要在我最簡單的 scala 項目中安裝一些依賴項(我正在通過一些教程),其中之一來自 github。 我的build.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")

也許,我缺少一些基本的 Scala/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類的com.github.haifenglhttps : //github.com/haifengl/smile/search? com.github.haifengl =% com.github.haifengl & com.github.haifengl = com.github.haifengl & com.github.haifengl =代碼

你確定包com.github.haifengl在你提到的 github 項目中嗎? 它可能存在於它的某些依賴項中嗎?

您不應該將ProjectRef添加到 github 項目中,而最好將其添加到依賴項中:

"com.github.haifengl" % "smile-core" % "1.0.4"

像下面這樣:

import sbt._

lazy val root = Project("root", file("."))
    .settings(
        name := "Xyclade ML practical examples",
        version := "1.0",
        scalaVersion := "2.10.6",
        sbtVersion := "0.13.9",
        libraryDependencies += Seq(
                "org.scala-lang" % "scala-swing" % "2.10.2",
                 "com.github.haifengl" % "smile-core" % "1.0.4"
    )

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM