分享

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

xuanxufeng 2015-10-23 17:11:23 发表于 总结型 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 0 16835



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

[mw_shl_code=bash,true]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)[/mw_shl_code]
解决方法是:
[mw_shl_code=bash,true]export MAVEN_OPTS="-Xmx2g -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=512m"[/mw_shl_code]

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

如果编译的过程出现以下错误,请设置一下Java path。
[mw_shl_code=bash,true][ERROR] 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 -> [Help 1][/mw_shl_code]

三、Please set the SCALA_HOME

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

[mw_shl_code=bash,true][ERROR] 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.
[ERROR] 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[/mw_shl_code]

没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条