我有很多时间试图在我的本地机器上设置Intellij上的火花。
目标:在没有任何错误的情况下运行git clone `https://github.com/apache/spark`
Import the project to Intellij as a Maven Project
build/mvn -DskipTests clean package
navigate to examples folder modify pom.xml (change occurrences of provided , test -> compile)
Open SparkPi.scala and add `.master("local[4]")` to Spark Session
Right click and run SparkPi
。
采取的措施:
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/MapMaker
at org.apache.spark.SparkContext.<init>(SparkContext.scala:271)
at org.apache.spark.SparkContext$.getOrCreate(SparkContext.scala:2257)
at org.apache.spark.sql.SparkSession$Builder$$anonfun$8.apply(SparkSession.scala:822)
at org.apache.spark.sql.SparkSession$Builder$$anonfun$8.apply(SparkSession.scala:814)
at scala.Option.getOrElse(Option.scala:121)
at org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:814)
at org.apache.spark.examples.SparkPi$.main(SparkPi.scala:31)
at org.apache.spark.examples.SparkPi.main(SparkPi.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.MapMaker
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 13 more
我遇到错误
<%= check_box_tag 'complete', '1', task.complete, {
onchange: "$(this).data('params', 'complete=' + this.checked)",
data: { url: url_for(action: 'complete', id: task.id,), remote: true, method: :patch },
} %>
答案 0 :(得分:1)
您需要在Intellij下rebuild
项目。悲伤却是真的:IJ无法简单地重用maven
构建的基础架构。
但它确实使用了命令行mvn
结构的 part :您需要先运行mvn
。
对于google MapMaker
类:它表示依赖项未正确下载且不可用。这应该在完全重建后解决。