使用Maven构建Spark失败

时间:2015-07-30 00:09:59

标签: scala maven apache-spark maven-2

我有一个用Scala编写的spark程序,我试图使用Maven构建它。然而,maven构建失败没有任何明显的错误。以下是错误消息:

  [INFO] Compiling 1 source files to D:\Scala-IDE\Workspace\ClassifierMaven\classifier\target\classes at 1438214677096
[ERROR] error: class file needed by package is missing.
[INFO] reference type ClassTag of package reflect refers to nonexisting symbol.
[ERROR] one error found
[INFO] Picked up _JAVA_OPTIONS: -Xmx2G
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.022 s
[INFO] Finished at: 2015-07-29T17:04:41-07:00
[INFO] Final Memory: 30M/879M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.scala-tools:maven-scala-plugin:2.15.0:compile (default) on project classifier: wrap: org.apache.commons.exec.ExecuteException: Process
exited with an error: 1(Exit value: 1) -> [Help 1]

有什么问题?

解决方案:问题在我的POM中缺少依赖性。我添加了依赖项,现在我收到了一条新的错误消息。 HEre是我现在得到的错误

[INFO] excludes = []
[INFO] D:\Scala-IDE\Workspace\ClassifierMaven\classifier\src\main\scala:-1: info: compiling
[INFO] Compiling 1 source files to D:\Scala-IDE\Workspace\ClassifierMaven\classifier\target\classes at 1438274292378
[INFO] java.lang.reflect.InvocationTargetException
[INFO]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO]  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
[INFO]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO]  at java.lang.reflect.Method.invoke(Method.java:606)
[INFO]  at org_scala_tools_maven_executions.MainHelper.runMain(MainHelper.java:161)
[INFO]  at org_scala_tools_maven_executions.MainWithArgsInFile.main(MainWithArgsInFile.java:26)
[ERROR] Caused by: java.lang.AssertionError: assertion failed: List(object Byte, object Byte)
[INFO]  at scala.tools.nsc.symtab.Symbols$Symbol.suchThat(Symbols.scala:1063) 
[INFO]  at scala.tools.nsc.symtab.Symbols$Symbol.companionModule0(Symbols.scala:1269)
[INFO]  at scala.tools.nsc.symtab.Symbols$Symbol.companionModule(Symbols.scala:1277)
[INFO]  at scala.tools.nsc.symtab.Symbols$Symbol.linkedClassOfClass(Symbols.scala:1296)
[INFO]  at scala.tools.nsc.symtab.Definitions$definitions$.addModuleMethod$1(Definitions.scala:707)
[INFO]  at scala.tools.nsc.symtab.Definitions$definitions$.initValueClasses(Definitions.scala:710)
[INFO]  at scala.tools.nsc.symtab.Definitions$definitions$.init(Definitions.scala:787)
[INFO]  at scala.tools.nsc.Global$Run.<init>(Global.scala:597)
[INFO]  at scala.tools.nsc.Main$.process(Main.scala:107)
[INFO]  at scala.tools.nsc.Main$.main(Main.scala:122)
[INFO]  at scala.tools.nsc.Main.main(Main.scala)
[INFO]  ... 6 more
[INFO] Picked up _JAVA_OPTIONS: -Xmx2G

1 个答案:

答案 0 :(得分:1)

您似乎缺少类路径中的scala-reflect包。我建议查看一些示例pom(如学习spark或其他一些数据库)并使用其中一个作为构建的起点。