【SBT】之 下载安装

一、简介

sbt uses a small number of concepts to support flexible and powerful build definitions.

sbt(simple build tools),简单构建工具

官方文档:https://www.scala-sbt.org/1.0/docs/Installing-sbt-on-Linux.html

目的:使用Scala编写的程序需要使用 sbt 进行编译打包。(Java程序使用Maven编译打包,Python程序通过 spark-submit直接提交)


预先准备

如官网所示,首先安装 JDK 版本需1.8以上



二、安装

命令行安装

echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt

sbt sbt-version 进行校验

同时可以用 sbt about 查看下信息
【SBT】之 下载安装

sbt sbt-version出现error

【SBT】之 下载安装
可以换一个命令试一下 sbt sbtVersion
【SBT】之 下载安装



三、遇到的问题

(1)apt-get update 失败

E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh > /dev/null; fi'
E: Sub-process returned an error code

解决:

sudo pkill -KILL appstreamcli

 wget -P /tmp https://launchpad.net/ubuntu/+archive/primary/+files/appstream_0.9.4-1ubuntu1_amd64.deb https://launchpad.net/ubuntu/+archive/primary/+files/libappstream3_0.9.4-1ubuntu1_amd64.deb
 
 sudo dpkg -i /tmp/appstream_0.9.4-1ubuntu1_amd64.deb /tmp/libappstream3_0.9.4-1ubuntu1_amd64.deb
 
 sudo apt-get install sbt

参考资料:https://askubuntu.com/questions/774986/appstreamcli-hanging-with-100-cpu-usage-during-update