系统相关
首页 > 系统相关> > Linux中安装sbt

Linux中安装sbt

作者:互联网

sbt下载官网地址:https://www.scala-sbt.org/download.html

一、Ubuntu安装

echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
sudo apt-get update
sudo apt-get install sbt

二、Centos安装

# remove old Bintray repo file
sudo rm -f /etc/yum.repos.d/bintray-rpm.repo
curl -L https://www.scala-sbt.org/sbt-rpm.repo > sbt-rpm.repo
sudo mv sbt-rpm.repo /etc/yum.repos.d/
sudo yum install sbt

三、测试

// 查看下载版本
// 第一次执行时,会下载一些文件包,然后才能正常使用,需要确保是联网的
sbt sbtVersion

新建scala源文件测试

object HelloScala extends App {
  println("Hello Scala")
}
sbt run

[root@alwaysdayone ~]# sbt run
[info] welcome to sbt 1.6.2 (Oracle Corporation Java 1.8.0_281)
[info] loading project definition from /root/workspace/chisel_leaning/project
[info] set current project to chisel_leaning (in build file:/root/workspace/chisel_leaning/)
[info] compiling 1 Scala source to /root/workspace/chisel_leaning/target/scala-2.12/classes ...
[info] Non-compiled module 'compiler-bridge_2.12' for Scala 2.12.15. Compiling...
[info]   Compilation completed in 8.652s.
[info] running HelloScala 
Hello Scala

 

标签:info,sbt,scala,sudo,apt,repo,Linux,安装
来源: https://www.cnblogs.com/Ao0216/p/16409344.html