本文主要是介绍sbt下载依赖太慢解决记录及配置阿里Maven仓库,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
新机器上安装的sbt执行太慢,主要是下载依赖包比较慢,还容易因下载不成功报错:
downloading https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.4.0/error_prone_annotations-2.4.0.jar ...
[SUCCESSFUL ] com.google.errorprone#error_prone_annotations;2.4.0!error_prone_annotations.jar (890ms)
downloading https://repo1.maven.org/maven2/org/scala-lang/modules/scala-collection-compat_2.12/2.3.2/scala-collection-compat_2.12-2.3.2.jar ...
[SUCCESSFUL ] org.scala-lang.modules#scala-collection-compat_2.12;2.3.2!scala-collection-compat_2.12.jar (5378ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/ivy/ivy/2.3.0-sbt-fbc4f586aeeb1591710b14eb4f41b94880dcd745/ivy-2.3.0-sbt-fbc4f586aeeb1591710b14eb4f41b94880dcd745.jar ...
[SUCCESSFUL ] org.scala-sbt.ivy#ivy;2.3.0-sbt-fbc4f586aeeb1591710b14eb4f41b94880dcd745!ivy.jar (23553ms):: problems summary ::
:::: WARNINGS
:::::::::::::::::::::::::::::::::::::::::::::::: FAILED DOWNLOADS ::
:: ^ see resolution messages for details ^ ::
::::::::::::::::::::::::::::::::::::::::::::::
:: io.get-coursier#lm-coursier-shaded_2.12;2.0.5!lm-coursier-shaded_2.12.jar
::::::::::::::::::::::::::::::::::::::::::::::
可以看到sbt跟maven一样,默认读取的国外的依赖仓库,配置从国内的依赖仓库下载就快多了,怎么修改配置呢,可以参考官方文档修改,这里以修改成先尝试从本机读取,再从阿里云maven仓库下载:
在家目录下创建文件.sbt/repositories写入内容:
[repositories]
local
my-maven-proxy-releases: https://maven.aliyun.com/nexus/content/repositories/central/
再次执行sbt就快多了
更多配置方式可以参考官方文档
这篇关于sbt下载依赖太慢解决记录及配置阿里Maven仓库的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!