Scala学习1之用sbt和脚本一步编译打包运行scala程序
2016-01-29 17:34
651 查看
用sbt和脚本一步编译打包运行scala程序
脚本:
代码程序:testPrintHelloXubo.scala
cp的文件请见另外一片博文:参考【1】
运行:
成功了
参考:
【1】 http://blog.csdn.net/xubo245/article/details/50603502
脚本:
cp /home/hadoop/cloud/scala-2.10.5/sbt/LocalScala1/build* ./ cp -r /home/hadoop/cloud/scala-2.10.5/sbt/LocalScala1/project ./ sbt compile sbt package sbt run
代码程序:testPrintHelloXubo.scala
//package scala2 /** * @author xubo601450868 */ object testPrintHelloXubo{ def main(args:Array[String]):Unit={ println("hello,scala"); println("hello,eclipse") // sum4(f2)(2,1); } def sum4(f:Int=>Int)(a:Int,b:Int)={ // if(a>b) return 0 else sum4(f)(a+1,b) } }
cp的文件请见另外一片博文:参考【1】
运行:
hadoop@Master:~/cloud/scala-2.10.5/sbt/examples$ cp ../LocalScala1/testPrintHelloXubo.scala ./ hadoop@Master:~/cloud/scala-2.10.5/sbt/examples$ sbtRun.sh [info] Set current project to helloworld project (in build file:/home/hadoop/cloud/scala-2.10.5/sbt/examples/) [info] Updating {file:/home/hadoop/cloud/scala-2.10.5/sbt/examples/}examples... [info] Resolving org.fusesource.jansi#jansi;1.4 ... [info] Done updating. [info] Compiling 1 Scala source to /home/hadoop/cloud/scala-2.10.5/sbt/examples/target/scala-2.10/classes... [success] Total time: 11 s, completed Jan 29, 2016 5:30:08 PM [info] Set current project to helloworld project (in build file:/home/hadoop/cloud/scala-2.10.5/sbt/examples/) [info] Packaging /home/hadoop/cloud/scala-2.10.5/sbt/examples/target/scala-2.10/helloworld-project_2.10-1.0.jar ... [info] Done packaging. [success] Total time: 2 s, completed Jan 29, 2016 5:30:15 PM [info] Set current project to helloworld project (in build file:/home/hadoop/cloud/scala-2.10.5/sbt/examples/) [info] Running testPrintHelloXubo hello,scala hello,eclipse [success] Total time: 2 s, completed Jan 29, 2016 5:30:22 PM hadoop@Master:~/cloud/scala-2.10.5/sbt/examples$
成功了
参考:
【1】 http://blog.csdn.net/xubo245/article/details/50603502
相关文章推荐
- Windows下Scala环境搭建
- Windows7下安装Scala 2.9.2教程
- Scala代码实现列出Hadoop 文件夹下面的所有文件
- ClassNotFoundException:scala.PreDef$
- sbt创建web项目
- XML 文件解析--含Unicode字符的XML文件
- 分分钟掌握快速排序(Java / Scala 实现)
- Scala极速入门
- Spark初探
- Scala实现REST操作
- Scala method call syntax
- 关于Scala多重继承的菱形问题
- Scala 高阶函数(high-order function)剖析
- Scala Monad Design Pattern
- Spray.io搭建Rest服务
- Spray.io搭建Rest — 支持Twirl模板并部署
- 搭建hadoop/spark集群环境
- Akka (actors) remote example
- scala工具库