为了账号安全,请及时绑定邮箱和手机立即绑定

如何使用 IntelliJ 解决 Scala 中的异常?

如何使用 IntelliJ 解决 Scala 中的异常?

猛跑小猪 2021-09-12 14:21:41
我正在尝试运行这个项目,我在 sbt 文件中添加了依赖项,我的 sbt 文件如下所示:name := "HelloScala"version := "0.1"scalaVersion := "2.11.8"libraryDependencies += "org.apache.spark" %% "spark-core" % "2.3.1"resolvers += Resolver.bintrayRepo("salesforce", "maven")libraryDependencies += "com.salesforce.transmogrifai" %% "transmogrifai-core" % "0.3.4"然后我Helloworld从他们的存储库中复制了该文件夹,但有很多问题。Information:10/09/18, 12:01 PM - Compilation completed with 88 errors and 0 warnings in 15 s 624 msError:scalac: missing or invalid dependency detected while loading class file 'package.class'.Could not access type Vector in value org.apache.spark.ml.linalg,because it (or its dependencies) are missing. Check your build definition formissing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)A full rebuild may help if 'package.class' was compiled against an incompatible version of org.apache.spark.ml.linalg.Error:scalac: missing or invalid dependency detected while loading class file 'OPVector.class'.Could not access type Vector in value org.apache.spark.ml.linalg,because it (or its dependencies) are missing. Check your build definition formissing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)A full rebuild may help if 'OPVector.class' was compiled against an incompatible version of org.apache.spark.ml.linalg.Error:scalac: missing or invalid dependency detected while loading class file 'OpEvaluatorBase.class'.我试图搜索这些问题,发现它可能是版本问题,但如果存在版本问题,我不知道应该使用哪个版本。但是,如果我尝试从命令行运行它,它会起作用:cd helloworld./gradlew compileTestScala installDist./gradlew -q sparkSubmit -Dmain=com.salesforce.hw.OpTitanicSimple -Dargs="\`pwd`/src/main/resources/TitanicDataset/TitanicPassengersTrainData.csv"它不适用于 IntelliJ ,我该如何解决这个问题?
查看完整描述

1 回答

?
呼啦一阵风

TA贡献1802条经验 获得超6个赞

在build.sbt两个依赖是缺失的:spark-mllib和spark-sql


libraryDependencies ++= Seq(

  "org.apache.spark" %% "spark-core" % "2.3.1",

  "org.apache.spark" %% "spark-mllib" % "2.3.1",

  "org.apache.spark" %% "spark-sql" % "2.3.1",

  "com.salesforce.transmogrifai" %% "transmogrifai-core" % "0.3.4"

)

这将删除第一个错误块。


查看完整回答
反对 回复 2021-09-12
  • 1 回答
  • 0 关注
  • 195 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号