1. 安装maven后,执行, 由于我测试hadoop 1.2.1下的GraphX,所以编译命令为::
mvn -Dhadoop.version=1.2.1 -DskipTests clean package
后来发现编译的项目太多,耗时太长,而eclipse插件编译尝试失败,eclisep的scala项目插件中似乎只要有一点编译问题就无法生成class文件,
最后编译只能使用mvn, 为了减少编译时间,修改了主代码目录下的pom.xml 参数,原始pom.xml:
<modules>
<module>core</module>
<module>bagel</module>
<module>graphx</module>
<module>mllib</module>
<module>tools</module>
<module>network/common</module>
<module>network/shuffle</module>
<module>streaming</module>
<module>sql/catalyst</module>
<module>sql/core</module>
<module>sql/hive</module>
<module>unsafe</module>
<module>assembly</module>
<module>external/twitter</module>
<module>external/flume</module>
<module>external/flume-sink</module>
<module>external/flume-assembly</module>
<module>external/mqtt</module>
<module>external/mqtt-assembly</module>
<module>external/zeromq</module>
<module>examples</module>
<module>repl</module>
<module>launcher</module>
<module>external/kafka</module>
<module>external/kafka-assembly</module>
</modules>
修改后:
<modules>
<module>core</module>
<module>bagel</module>
<module>graphx</module>
<module>mllib</module>
<module>tools</module>
<module>network/common</module>
<module>network/shuffle</module>
<module>streaming</module>
<module>unsafe</module>
<module>assembly</module>
<module>examples</module>
<module>repl</module>
<module>launcher</module>
</modules>
尽管最后编译因为maven库无法下载没有全部通过,但我需要的GraphX已经通过了,我只需要它打包后的jar文件即可。
这里还遇到一个问题是eclipse上装的scala插件是2.11的,但是提示似乎需要2.10 ,于是重装本机scala和eclips插件。
终于GraphX在eclipse项目不报错了,然后能生成class文件。OK
2. 将修改后的class文件使用360压缩软件加入原始包中,替换slave节点对应assambly包,执行即可。