通过IDEA创建基于sbt的Scala项目,相关以来会通过sbt插件进行下载,由于是第一次创建,需要下载的jar包会比较多,时间会很长。
在等待sbt下载提示消失后,在控制台看到很多错误信息,主要错误内容如下:
Error:Error while importing SBT project:<br/>...<br/><pre>unresolved dependency: org.scala-sbt#process;0.13.7: not found unresolved dependency: org.scala-sbt#run;0.13.7: not found unresolved dependency: org.scala-sbt#relation;0.13.7: not found unresolved dependency: org.scala-sbt#task-system;0.13.7: not found unresolved dependency: org.scala-sbt#tasks;0.13.7: not found unresolved dependency: org.scala-sbt#tracking;0.13.7: not found
没有发现依赖包。
还有
connection refused之类的错误。应该是存储这个jar的仓库无法连接的问题。
解决方法:就是在sbt原有的repositories基础上(可以查看sbt-launch.jar文件),创建一个新的repositories文件(位于用户的根目录下(/Users/admin/),创建.sbt目录,放在里面, 添加两个连接速度比较快的jar仓库即可,记得去掉每行尾部空白)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[repositories]
local
dl bintray: https://dl.bintray.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
jcenter: https://jcenter.bintray.com/
typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
maven-central
sonatype-snapshots: https://oss.sonatype.org/content/repositories/snapshots
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
然后就会发现,依赖下载的速度快了很多。