sbt安装与配置

简介: 下载地址:http://www.scala-sbt.org/download.html当前版本:sbt-0.13.13.tgz安装1.解压并赋予权限[root@hidden util]# tar -zxvf sbt-0.

下载地址:http://www.scala-sbt.org/download.html

当前版本:sbt-0.13.13.tgz

安装

1.解压并赋予权限

[root@hidden util]# tar -zxvf sbt-0.13.13.tgz 
sbt-launcher-packaging-0.13.13/
sbt-launcher-packaging-0.13.13/conf/
sbt-launcher-packaging-0.13.13/conf/sbtconfig.txt
sbt-launcher-packaging-0.13.13/conf/sbtopts
sbt-launcher-packaging-0.13.13/bin/
sbt-launcher-packaging-0.13.13/bin/sbt.bat
sbt-launcher-packaging-0.13.13/bin/sbt
sbt-launcher-packaging-0.13.13/bin/sbt-launch.jar
sbt-launcher-packaging-0.13.13/bin/sbt-launch-lib.bash
[root@hidden util]# mv sbt-launcher-packaging-0.13.13 sbt
[root@hidden util]# chown -R root sbt
[root@hidden util]# chgrp -R root sbt
[root@hidden util]# cd sbt
[root@hidden sbt]# ls
bin  conf

2.建立启动脚本
在当前目录下(sbt/)创建文件sbt:vim sbt
编辑如下内容:(当前sbt的目录为:/root/util/sbt/)

#!/bin/bash
SBT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
java $SBT_OPTS -jar /root/util/sbt/bin/sbt-launch.jar "$@"

添加权限

[root@hidden sbt]# chmod a+x sbt

3.配置PATH环境变量
之后在/etc/profile文件中添加(vim /etc/profile)

export PATH=$PATH:/root/util/sbt/

之后将文件立即生效:

[root@hidden sbt]# source /etc/profile
  1. 验证成功
    最后测试是否验证成功:
[root@hidden sbt]# sbt sbt-version
[info] Set current project to sbt (in build file:/root/util/sbt/)
[info] 0.13.13

异常

在实际安装过程中遇到如下的问题,在刚开始运行sbt sbt-version时出现“Error: Could not retrieve sbt 0.13.13”:

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
Getting org.scala-sbt sbt 0.13.13 ...
You probably access the destination server through a proxy server that is not well configured.
You probably access the destination server through a proxy server that is not well configured.
You probably access the destination server through a proxy server that is not well configured.
You probably access the destination server through a proxy server that is not well configured.
(省略若干....)
:: problems summary ::
:::: WARNINGS
    Host repo1.maven.org not found. url=https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.6/scala-library-2.10.6.pom
    Host repo1.maven.org not found. url=https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.6/scala-library-2.10.6.jar
(省略若干....)
unresolved dependency: org.scala-sbt#launcher-interface;1.0.0-M1: not found
unresolved dependency: org.scala-sbt#compiler-interface;0.13.13: not found
download failed: org.scala-sbt#sbt;0.13.13!sbt.jar
download failed: org.scala-sbt#main;0.13.13!main.jar
download failed: org.scala-sbt#actions;0.13.13!actions.jar
download failed: org.scala-sbt#task-system;0.13.13!task-system.jar
Error during sbt execution: Error retrieving required libraries
  (see /root/.sbt/boot/update.log for complete log)
Error: Could not retrieve sbt 0.13.13

这时候需要添加一点东西,首先在conf/sbtconfig.txt中添加:

[root@hidden sbt]# vim conf/sbtconfig.txt

在此文件中添加:

-Dsbt.boot.directory=/root/util/sbt/.sbt/boot
-Dsbt.global.base=/root/util/sbt/.sbt
-Dsbt.ivy.home=/root/util/sbt/.ivy2
-Dsbt.repository.config=/root/util/sbt/conf/repo.properties
-Dsbt.repository.secure=false

其次在conf/目录下添加repo.properties中添加一些内容

[root@hidden sbt]# vim conf/repo.properties

repo.properties中添加:

[repositories]  
  local
  Nexus osc : https://code.lds.org/nexus/content/groups/main-repo
  Nexus osc thirdparty : https://code.lds.org/nexus/content/groups/plugin-repo/
  typesafe: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly  
  typesafe2: http://repo.typesafe.com/typesafe/releases/
  sbt-plugin: http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/
  sonatype: http://oss.sonatype.org/content/repositories/snapshots  
  uk_maven: http://uk.maven.org/maven2/  
  ibibli: http://mirrors.ibiblio.org/maven2/  
  repo2: http://repo2.maven.org/maven2/

  comp-maven:http://mvnrepository.com/artifact/
  store_cn:http://maven.oschina.net/content/groups/public/
  store_mir:http://mirrors.ibiblio.org/maven2/
  store_0:http://maven.net.cn/content/groups/public/
  store_1:http://repo.typesafe.com/typesafe/ivy-releases/
  store_2:http://repo2.maven.org/maven2/

  sbt-releases-repo: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
  sbt-plugins-repo: http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
  maven-central: http://repo1.maven.org/maven2/

保存。(按Esc, 输入:wq)

此时再第一次执行sbt sbt-version,效果如下:

[root@hidden sbt]# sbt sbt-version
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
Getting org.scala-sbt sbt 0.13.13 ...
downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.13/jars/sbt.jar ...
    [SUCCESSFUL ] org.scala-sbt#sbt;0.13.13!sbt.jar (4536ms)
downloading https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.6/scala-library-2.10.6.jar ...
    [SUCCESSFUL ] org.scala-lang#scala-library;2.10.6!scala-library.jar (5143ms)
downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/main/0.13.13/jars/main.jar ...
    [SUCCESSFUL ] org.scala-sbt#main;0.13.13!main.jar (13976ms)
downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/0.13.13/jars/compiler-interface.jar ...
    [SUCCESSFUL ] org.scala-sbt#compiler-interface;0.13.13!compiler-interface.jar (4906ms)
(省略若干....)
:: retrieving :: org.scala-sbt#boot-scala
    confs: [default]
    5 artifacts copied, 0 already retrieved (24494kB/764ms)
[info] Set current project to sbt (in build file:/root/util/sbt/)
[info] 0.13.13

如果出现一部分download成功一部分失败的情况,可以多试几下sbt sbt-version命令,直到只出现:

[info] Set current project to sbt (in build file:/root/util/sbt/)
[info] 0.13.13

说明安装成功。

目录
相关文章
|
人工智能 计算机视觉
Dataset之BDD100K:BDD100K数据集的简介、下载、使用方法之详细攻略
Dataset之BDD100K:BDD100K数据集的简介、下载、使用方法之详细攻略
Dataset之BDD100K:BDD100K数据集的简介、下载、使用方法之详细攻略
|
7月前
|
存储 缓存 人工智能
阿里云百炼大模型服务平台是什么?最新模型调用收费标准、新人免费额度以及常见问题解答
阿里云百炼大模型服务平台是集成千问及第三方模型的一站式开发与应用平台,提供模型调用、调优、部署及应用构建等全链路服务。其优势包括丰富的模型生态、全链路开发工具、企业级安全合规及灵活计费模式,支持低/零代码开发,助力企业与开发者快速落地AI应用。2026年,新用户开通即享超7000万免费tokens,有效期90天,仅限模型推理调用,旨在降低初期成本,助力用户快速构建AI应用。
|
人工智能 前端开发 JavaScript
用 通义灵码打造创意 Loading 动画生成器:只需三个词,就能玩出花来!
本文介绍了如何利用“通义灵码”打造一个创意 Loading 动画生成器。作者通过输入“科技感、电波、液体”三个关键词,借助 AI 工具自动生成酷炫的 CSS 动画效果,无需手动编写复杂代码。整个过程高效便捷,只需描述风格关键词,即可生成多种加载动画,并可封装为组件直接使用,极大地提升了开发效率与创意表达。
|
数据采集 监控 NoSQL
Airflow调度爬虫任务:从零搭建高效定时采集系统
Airflow以DAG实现爬虫任务依赖管理,支持分钟级调度与Web监控,解决crontab无依赖控制、Jenkins不灵活等问题。结合PythonOperator、动态参数传递与分布式架构,可构建高可用、易扩展的自动化采集系统,适用于电商价格监控等场景。
563 0
|
人工智能 自然语言处理 机器人
招商银行X通义大模型 ,2024年度AI最佳实践案例!
招商银行X通义大模型 ,2024年度AI最佳实践案例!
|
jenkins Java 持续交付
使用Jenkins完成springboot项目快速更新
本文介绍了使用Jenkins和WinSW实现SpringBoot项目自动化部署的完整流程。首先讲解了Jenkins作为持续集成工具的作用,然后详细说明了环境准备步骤:包括JDK版本管理、WinSW服务配置(含XML文件修改)以及bat启动脚本编写。重点演示了Jenkins的项目配置方法,包括源码管理设置和构建步骤中的Windows批处理命令调用。通过这套方案,开发者只需推送代码到Git仓库,即可触发Jenkins自动完成项目构建、服务重启等全流程,显著提升部署效率。文章还提到IDEA的Jenkins插件可进
743 1
|
大数据 数据处理 数据中心
x86和x64架构的区别及应用
x86和x64架构的区别及应用
|
安全 Oracle 关系型数据库
Oracle WebLogic Server远程代码执行漏洞 CVE-2020-14750 已亲自复现_cve-2020-14750漏洞复现
Oracle WebLogic Server远程代码执行漏洞 CVE-2020-14750 已亲自复现_cve-2020-14750漏洞复现
|
大数据 数据管理 分布式数据库
探索 HBase GUI 工具,助您轻松驾驭大数据世界!
从此告别繁琐,迎接大数据时代的新利器! #HBase #GUI #数据管理 #工具分享
1266 2
探索 HBase GUI 工具,助您轻松驾驭大数据世界!
|
Ubuntu Linux 数据安全/隐私保护
Linux(24) 如何在Ubuntu中操作rootfs.img文件
Linux(24) 如何在Ubuntu中操作rootfs.img文件
2933 0