sbt导入本地库

时间:2015-10-19 14:04:46

标签: scala import sbt

我在使用sbt导入本地库时遇到了麻烦。

这是我尝试导入https://github.com/deeplearning4j/nd4s的库。

我已经按照github上的说明操作了,我做了sbt +publish-local

如果我理解正确,那么库现在应该在我的本地存储库中,我可以将其视为:

lucas-MacBook-Pro:~ donbeo$ cd .ivy2/local/org.nd4j/nd4s_2.1
nd4s_2.10/      nd4s_2.11/      nd4s_2.12.0-M1/ 

现在如何在我的项目中导入它?

This is my current `build.sbt` but it is not working. 


name := "deeplearning4j-examples-scala"

version := "1.0"

scalaVersion := "2.10.4"

lazy val root = project.in(file("."))

libraryDependencies ++= Seq(
  "commons-io" % "commons-io" % "2.4",
  "com.google.guava" % "guava" % "18.0",
  "org.deeplearning4j" % "deeplearning4j-core" % "0.4-rc3.4",
  "org.deeplearning4j" % "deeplearning4j-nlp" % "0.4-rc3.4",
  "org.deeplearning4j" % "deeplearning4j-ui" % "0.4-rc3.4",
  "org.jblas" % "jblas" % "1.2.4",
  "org.nd4j" % "canova-nd4j-image" % "0.0.0.11",
  "org.nd4j" % "nd4j-jblas" % "0.4-rc3.5",
  "org.nd4j" % "nd4j-x86" % "0.4-rc3.5",
  "org.jfree" % "jfreechart" % "1.0.14",
  "com.github.wookietreiber" %% "scala-chart" % "latest.integration"
)

resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

resolvers += "Sonatype release Repository" at "http://oss.sonatype.org/service/local/staging/deploy/maven2/"

resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository/"


libraryDependencies  ++= Seq(
  // other dependencies here
  "org.scalanlp" %% "breeze" % "0.11.2",
  // 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.11.2",
  // the visualization library is distributed separately as well.
  // It depends on LGPL code.
  "org.scalanlp" %% "breeze-viz" % "0.11.2"
)

libraryDependencies += "com.nd4j" %% "nd4s" % "2.11" // NOT WORKING

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/"
)

结束前5行我尝试导入库。

1 个答案:

答案 0 :(得分:3)

build.sbt开始,libraryDependencies应为

libraryDependencies += "org.nd4j" %% "nd4s" % "0.4-rc3"