sbt安装与配置
下載地址:http://www.scala-sbt.org/download.html
當前版本:sbt-0.13.13.tgz
歡迎支持筆者新作:《深入理解Kafka:核心設計與實踐原理》和《RabbitMQ實戰指南》,同時歡迎關注筆者的微信公眾號:朱小廝的博客。
歡迎跳轉到本文的原文鏈接:https://honeypps.com/java/sbt-install-and-config/
##安裝
1.解壓并賦予權限
2.建立啟動腳本
在當前目錄下(sbt/)創建文件sbt:vim sbt
編輯如下內容:(當前sbt的目錄為:/root/util/sbt/)
添加權限
[root@hidden sbt]# chmod a+x sbt3.配置PATH環境變量
之后在/etc/profile文件中添加(vim /etc/profile)
之后將文件立即生效:
[root@hidden sbt]# source /etc/profile最后測試是否驗證成功:
異常
在實際安裝過程中遇到如下的問題,在剛開始運行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 :: :::: WARNINGSHost repo1.maven.org not found. url=https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.6/scala-library-2.10.6.pomHost 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.propertiesrepo.properties中添加:
[repositories] localNexus osc : https://code.lds.org/nexus/content/groups/main-repoNexus 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-scalaconfs: [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說明安裝成功。
歡迎跳轉到本文的原文鏈接:https://honeypps.com/java/sbt-install-and-config/
歡迎支持筆者新作:《深入理解Kafka:核心設計與實踐原理》和《RabbitMQ實戰指南》,同時歡迎關注筆者的微信公眾號:朱小廝的博客。
總結
- 上一篇: 从零开始玩转JMX(四)——Apache
- 下一篇: RabbitMQ单机多实例配置