如何星火用的IntelliJ IDE斯卡拉项目集成? [英] How to integrate Spark with Scala project in IntelliJ IDE?
问题描述
我使用的IntelliJ IDE与Scala和星火玩。在这个IDE我创建了一个Scala的对象Scala的项目(见图片)。
I am using IntelliJ IDE to play with Scala and Spark. In this IDE I created a Scala project with a Scala object (see picture).
我使用的样本回归code从这个网站。
I used the sample Regression code from this web site.
我也下载框架星火从GitHub非Maven的用户(如这里解释 )。
I also downloaded Spark Framework as a non-Maven user from GitHub (as explained here).
我的问题是如何将这种星火框架与我的斯卡拉项目联系起来?另外,我需要整合一些其他的库能够与星火MLLib?
My question is how to link this Spark Framework with my Scala project? Also do I need to integrate some additional libraries to be able to work with Spark MLLib?
推荐答案
我建议创建的简单的SBT项目与以下相关的 build.sbt
I would recommend create simple sbt project with following dependencies in the build.sbt
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % "1.5.1",
"org.apache.spark" %% "spark-sql" % "1.5.1" )
随后的打开的它通过它开始从导入SBT项目菜单。
Then Open it via menu which start importing project from sbt.
在IDEA完成导入\\下载\\索引库,你可以只是 CTRL移-D
万岁 - 你有语法高亮完善多行的编辑和完成火花控制台。
When IDEA finishes importing\downloading\indexing libraries you can just ctrl-shift-D
and voilà - you have spark console with syntax perfect highlighting multiline editing and completion.
然后,您可以创建目录 / src目录/主/斯卡拉
如果不存在了。或者,你可以做想法的选项为您创建它:
Then you can create directory /src/main/scala
if it not exists. Or you could make IDEA create it for you in options:
接下来,您应该建立在斯卡拉
目录中新的对象,选择新斯卡拉类 - 对象
Next you should create new object in the scala
directory, select "new scala class - object":
接着写在主
方法有些code在你的对象,并通过 CTRL移F10 $ C运行$ C>或上下文命令
Next write some code in the main
method in your object, and run it via ctrl-shift-F10
or context command
和享受您的结果
这篇关于如何星火用的IntelliJ IDE斯卡拉项目集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!