安装环境
Linux:CentOS6.7
sbt:sbt-0.13.15
1 - yum安装sbt
sbt二进制文件发布到bintray,而Bintray方便地提供了RPM资源库。我们只需要将存储库添加到全举报管理器将检查的地方。
[root@vm bin]# curl https://bintray.com/sbt/rpm/rpm > bintray-sbt-rpm.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
159 159 0 159 0 0 121 0 --:--:-- 0:00:01 --:--:-- 230
[root@vm bin]# sudo mv bintray-sbt-rpm.repo /etc/yum.repos.d/
[root@vm bin]# sudo yum install sbt
这里如果选择手动安装,去sbt官网下载压缩包,到服务器上解压安装。设置完环境变量即可使用。
2 - 完成安装
安装完成后第一次输入sbt命令,界面会卡住,实际上是在下载相关的依赖包。国外镜像巨慢,估计要好几个小时。
由于sbt默认的reoisitory是maven,里面有些会被墙。所以修改为aliyun的repository,再下载
配置aliyun的repository
[root@vm .sbt]# vi ~/.sbt/repositories
[repositories]
local
aliyun-nexus: http://maven.aliyun.com/nexus/content/groups/public/
jcenter: https://jcenter.bintray.com/
typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
maven-central
注意:检查上面命令,每一行最后不要留空格,否则会报错!
运行sbt,开始下载jar包。虽然速度也不快,但是能成功安装!
[root@vm .sbt]# sbt
Getting org.scala-sbt sbt 0.13.15 (this may take some time)...
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/ivy/0.13.15/jars/ivy.jar ...
[SUCCESSFUL ] org.scala-sbt#ivy;0.13.15!ivy.jar (142039ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/tracking/0.13.15/jars/tracking.jar ...
[SUCCESSFUL ] org.scala-sbt#tracking;0.13.15!tracking.jar (11548ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/incremental-compiler/0.13.15/jars/incremental-compiler.jar ...
[SUCCESSFUL ] org.scala-sbt#incremental-compiler;0.13.15!incremental-compiler.jar (31245ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/cache/0.13.15/jars/cache.jar ...
[SUCCESSFUL ] org.scala-sbt#cache;0.13.15!cache.jar (26973ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/test-agent/0.13.15/jars/test-agent.jar ...
[SUCCESSFUL ] org.scala-sbt#test-agent;0.13.15!test-agent.jar (28292ms)
等待命令完成,sbt安装完成。
验证安装
[root@vm ~]# sbt
[info] Loading project definition from /root/project
[info] Set current project to root (in build file:/root/)
>
下载过程中vi ~/.sbt/boot/update.log可以查看进度。
如果sbt开始报lock的错,将~/.sbt/boot下的sbt.boot.lock文件删除即可。