xuanxufeng 发表于 2015-10-23 17:11:23

用Maven编译Spark 源码错误及解决办法汇总




一、设置MAVEN_OPTS参数
  在编译Spark的时候Maven需要很多内存,否则会出现类似下面的错误信息:

Exception in thread "main" java.lang.OutOfMemoryError: PermGen space
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:545)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
解决方法是:
export MAVEN_OPTS="-Xmx2g -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=512m"

二、 Cannot run program "javac": java.io.IOException:

如果编译的过程出现以下错误,请设置一下Java path。
Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.1.6:
compile (scala-compile-first) on project spark-core_2.10: wrap:
java.io.IOException: Cannot run program "javac": java.io.IOException:
error=2, No such file or directory ->

三、Please set the SCALA_HOME

这个错误很明显没有设置SCALA_HOME,去下载一个scala,然后设置一下即可。

Failed to execute goal org.apache.maven.plugins:
maven-antrun-plugin:1.7:run (default) on project spark-core_2.10:
An Ant BuildException has occured: Please set the SCALA_HOME
(or SCALA_LIBRARY_PATH if scala is on the path) environment
variables and retry.
around Ant part ...<fail message="Please set the SCALA_HOME
(or SCALA_LIBRARY_PATH if scala is on the path) environment variables
and retry.">... @ 6:126 in spark-1.0.0/core/target/antrun/build-main.xml

页: [1]
查看完整版本: 用Maven编译Spark 源码错误及解决办法汇总