Scala 对象压缩不是包org.apache.commons的成员
我一直在尝试使用apache commons。 但是,它失败并得到以下错误。 我不知道如何修理它。也许,需要在build.sbt中添加一些内容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]
$ 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"
要在将来自己找到这个问题,请在上搜索我的答案对您无效吗?它工作正常!!谢谢你的建议。