我想使用 scalax.io._来操纵SBT的文件操作. 当我运行它时,我收到错误消息,显示找不到scalax. sbt runimport scalax.io._[error] ^[error] iotest.scala:49: not found: object scalax 如何找到这个特定的库依赖?
当我运行它时,我收到错误消息,显示找不到scalax.
>sbt run import scalax.io._ [error] ^ [error] iotest.scala:49: not found: object scalax
如何找到这个特定的库依赖?
一个更一般的问题,如何获取任何库的库依赖信息?
例如,如果我需要在scala中使用actor,我需要指定一个库依赖项.如何找到库依赖?
使用http://search.maven.org/搜索库,当您搜索scala-io时,您将获得可用的scala-io库列表.
由于我从未使用过该库,因此我从Scala IO Documentation复制了ScalaIOExample示例以获得一个有效的示例.它需要scalax.io和scalax.file包作为scala-io-file工件分发.搜索工件导致Artifact Details For com.github.scala-incubator.io:scala-io-file_2.10:0.4.2,其中包含有关如何在依赖关系信息部分中使用Scala SBT的信息.
有了这个,我在一个sbt项目中创建了以下build.sbt:
scalaVersion := "2.10.3" libraryDependencies += "com.github.scala-incubator.io" %% "scala-io-file" % "0.4.2"
它将scala-io-file_2.10-0.4.2.jar添加到类路径并在项目中执行run会产生以下结果:
$sbt run [info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins [info] Loading project definition from /Users/jacek/sandbox/stackoverflow/sbt-scala-io/project [info] Set current project to sbt-scala-io (in build file:/Users/jacek/sandbox/stackoverflow/sbt-scala-io/) [info] Running ScalaIOExample Not interrupting system thread Thread[Keep-Alive-Timer,8,system] Not interrupting system thread Thread[Keep-Alive-SocketCleaner,8,system] [success] Total time: 5 s, completed Dec 31, 2013 11:16:42 PM