#Error: Could not retrieve sbt 1.3.8
使用IDEA自带的sbt下载jar包时,由于资源在外网的限制(默认连接到maven官网),通常下载速度会很慢甚至下载会以失败告终,配置自定义sbt时还会出现‘Error: Could not retrieve sbt 1.3.8’错误。所以我们配置了阿里云的镜像来加速下载。
- 首先我们sbt官网下载sbt安装包(下载地址:)
- 安装sbt(一直点next)
- 找到sbt的安装目录(我的是D:\sbt),在conf目录下新建一个repository.properties,添加如下内容:
repository.properties内容:
[repositories]
local
aliyun-nexus: http://maven.aliyun.com/nexus/content/groups/public/
ibiblio-maven: http://maven.ibiblio.org/maven2/
typesafe-ivy: https://dl.bintray.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
uk-repository: http://uk.maven.org/maven2/
jboss-repository: http://repository.jboss.org/nexus/content/groups/public/
typesafe: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
sonatype-oss-releases
maven-central
sonatype-oss-snapshots
- 在sbtconfig.txt的末尾添加如下内容:
-Dsbt.log.format=true
-Dsbt.boot.directory=D:/sbt/.sbt/boot
-Dsbt.ivy.home=D:/sbt/.ivy2
-Dsbt.global.base=D:/sbt/.sbt
-Dsbt.repository.config=D:/sbt/conf/repository.properties
注意:以上路径均为你sbt的安装路径。要仔细检查以免出错。
6. 进入cmd并启动sbt(sbt在安装时会将路径加入到你的Classpath中),在第一次启动时会让你选择continue或quit,选c。
7. 然后会开始安装各种jar包,需要等待挺长时间的(也可能是我的网速太慢…)
8. 安装完之后,开始打开我们的IDEA,点file->settings,搜索sbt,在VM parameter选项那里添加-Dsbt.override.build.repos=true ,然后在Launcher选项那里选择custom,并添加自己的sbt launch.jar的位置,如D:\sbt\binsbt-launch.jar,至此,配置自己的sbt就完成了。