码迷,mamicode.com
首页 > 系统相关 > 详细

sbt Eclipse scala 环境搭建——Mac下安装sbt

时间:2015-07-08 12:47:16      阅读:2002      评论:0      收藏:0      [点我收藏+]

标签:

为了可以用Eclipse编译基于Scala的Spark Project,需要安装sbt

环境:OS X Yosemite 10.10.3

1.安装Xcode

因为要在终端用macports安装sbt,而Xcode是macports安装的前提,所以要先去APPstore下载Xcode,并安装其command line developer tools。

安装比较简单,详见:https://guide.macports.org/#installing

2.安装macports

去官网下载其安装包并安装,和安装QQ一样简单

详见:https://guide.macports.org/#installing

3.安装sbt

在终端下输入一下命令:

port install sbt

看到类似以下信息就算安装完了:

...这里省略很多log...
downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/apply-macro/0.13.7/jars/apply-macro.jar ... [SUCCESSFUL ] org.scala-sbt#apply-macro;0.13.7!apply-macro.jar (9005ms) :: retrieving :: org.scala-sbt#boot-app confs: [default] 51 artifacts copied, 0 already retrieved (15709kB/378ms) Getting Scala 2.10.4 (for sbt)... downloading https://repo1.maven.org/maven2/org/scala-lang/jline/2.10.4/jline-2.10.4.jar ... [SUCCESSFUL ] org.scala-lang#jline;2.10.4!jline.jar (1589ms) :: retrieving :: org.scala-sbt#boot-scala confs: [default] 5 artifacts copied, 0 already retrieved (24459kB/195ms) [info] Set current project to hello (in build file:/Users/apple/Desktop/hello/)

 4.跑个hello world

为了验证sbt是不是安装成功,我们跑个hello world试试

$ mkdir hello
$ cd hello
$ echo ‘object Hi { def main(args: Array[String]) = println("Hi!") }‘ > hw.scala
$ sbt
...
> run
[info] Updating {file:/Users/apple/Desktop/hello/}hello...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/apple/Desktop/hello/target/scala-2.10/classes...
[info] Running Hi 
Hi!
[success] Total time: 4 s, completed Jul 8, 2015 11:17:46 AM

这是官网的示例,按照他的做并出现相同的结果就对了!

到此,mac下安装sbt就结束了。

 

sbt Eclipse scala 环境搭建——Mac下安装sbt

标签:

原文地址:http://www.cnblogs.com/captainlucky/p/4629616.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!