设为首页 加入收藏

TOP

sbt 学习笔记(1)sbt安装和交互式界面使用
2017-10-09 14:06:08 】 浏览:3434
Tags:sbt 学习 笔记 安装 交互式 界面 使用

下载sbt:

http://www.scala-sbt.org/download.html

 

 

解压zip文件F:\sbt-0.13.15

 

配置环境变量

 

如果需要可以修改F:\sbt-0.13.15\sbt\conf\sbtconfig.txt

#ivy的cache等,保存到指定的文件夹;不配置的话sbt下载的jar包都会默认放到C盘的用户目录下

#-Dsbt.boot.directory=F:/sbt-0.13.15/sbt/boot

#The directory defined here is used to store all cached JARs resolved launcher.

#-Dsbt.ivy.home=F:/sbt-0.13.15/sbt/.ivy2

#-Dsbt.override.build.repos=true
#-Dsbt.global.base=F:/sbt-0.13.15/sbt/.sbt

#代理设置

#-Dhttp.proxyHost=xxx.xxx.com  

#-Dhttp.proxyPort=xx

#-Dsbt.repository.config=F:/sbt-0.13.15/sbt/conf/repo.properties

建立repo.properties,添加阿里云

[repositories]

local

nexus-aliyun:http://maven.aliyun.com/nexus/content/groups/public

nexus-aliyun-ivy:http://maven.aliyun.com/nexus/content/groups/public/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]

typesafe: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly

 

创建一个文件夹FirstSbtProject,构建以下目录

 

 

修改build.sbt 内容

 

name := "FirstSbtProject"

version := "1.0" 

scalaVersion := "2.10.6"

进入到项目根目录,输入sbt回车进入sbt交互模式, 第一次运行会比较慢,耐心等待,要下载相关的jars

输入help命令查询,即会列出一堆可用的命令

输入show name,看当前项目的名字,输入show libraryDependencies看当前项目依赖的库,libraryDependencies太长记不住?输入lib后按tab键,可列出相关内容

 

有一个强大的任务不得不特别拎出来说一下:console 
输入console回车,会在当前会话内启动一个Scala REPL

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Akka(8): 分布式运算:Remotin.. 下一篇Akka(9): 分布式运算:Remotin..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目