无法从github

时间:2015-12-23 10:08:54

标签: scala sbt

我需要在我最简单的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.haifenglhttps://github.com/haifengl/smile/search?utf8=%E2%9C%93&q=com.github.haifengl&type=Code

1 个答案:

答案 0 :(得分:2)

你确定包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"
    )