Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 对象压缩不是包org.apache.commons的成员_Scala_Sbt_Apache Commons - Fatal编程技术网

Scala 对象压缩不是包org.apache.commons的成员

Scala 对象压缩不是包org.apache.commons的成员,scala,sbt,apache-commons,Scala,Sbt,Apache Commons,我一直在尝试使用apache commons。 但是,它失败并得到以下错误。 我不知道如何修理它。也许,需要在build.sbt中添加一些内容 $ sbt > clean > compile [error] hw.scala:3: object compress is not a member of package org.apache.commons [error] import org.apache.commons.compress.utils.IOUtils [error]

我一直在尝试使用apache commons。 但是,它失败并得到以下错误。 我不知道如何修理它。也许,需要在build.sbt中添加一些内容

$ sbt
> clean
> compile
[error] hw.scala:3: object compress is not a member of package org.apache.commons
[error] import org.apache.commons.compress.utils.IOUtils
[error]                           ^
[error] hw.scala:24: not found: value IOUtils
[error]     val bytes = IOUtils.toByteArray(new FileInputStream(imgFile))
[error]                 ^
[error] two errors found
[error] (compile:compileIncremental) Compilation failed
斯卡拉酒店

import org.apache.commons.codec.binary.{ Base64 => ApacheBase64 }
import org.apache.commons.compress.utils.IOUtils

...
build.sbt

name := "hello"

version := "1.0"

scalaVersion := "2.11.8"

libraryDependencies ++= Seq(
  "commons-codec" % "commons-codec" % "1.10",
  "commons-io" % "commons-io" % "2.4"
)

将此添加到build.sbt中:

// https://mvnrepository.com/artifact/org.apache.commons/commons-compress
libraryDependencies += "org.apache.commons" % "commons-compress" % "1.14"

要在将来自己找到这个问题,请在

上搜索我的答案对您无效吗?它工作正常!!谢谢你的建议。