首页 > 解决方案 > 为什么命令行出现“不是包的成员”和“找不到类”错误,而不是 Intellij?

问题描述

我有一个 Scala 测试,可以在 Intellij 中使用,但不能在终端中使用命令行。代码 + 错误:

[error] ... object Configuration is not a member of package org.apache.hadoop.conf
[error] ... object FileSystem is not a member of package org.apache.hadoop.fs
[error] import org.apache.hadoop.fs.{FileSystem, FileUtil, Path}
[error]        ^
[error] ... Class org.apache.hadoop.ha.ServiceFailedException not found - continuing with a stub.
[error]       val hdfsCluster = new MiniDFSCluster.Builder(conf).build()
[error]                             ^
[error] ... not found: type Configuration
[error]       val conf = new Configuration()
[error]                      ^
[error] ... not found: value FileUtil
[error]       FileUtil.fullyDelete(baseDir)
[error]       ^
[error] ... not found: value FileSystem
[error]       val hdfs = FileSystem.get(conf);
[error]                  ^
[error] ... not found: value FileUtil
[error]       FileUtil.fullyDelete(baseDir);
[error]       ^
[error] ... not found: type Configuration
[error]       val conf = new Configuration();
[error]                      ^
[error] ... not found: value FileUtil

Sbt 依赖:

"org.apache.hadoop" % "hadoop-hdfs" % "2.6.5" % Test classifier "tests",
"org.apache.hadoop" % "hadoop-common" % "2.6.5" % Test classifier "tests"

标签: scalahadoopintellij-ideasbt

解决方案


推荐阅读