My Blog: sbt卡住的解決辦法,sbt設(shè)置代理
方法一:設(shè)置國(guó)內(nèi)源(失敵赂亍)
- 創(chuàng)建
~/.sbt/repositories
文件揍鸟。 - 寫(xiě)入
[repositories]
local
aliyun: http://maven.aliyun.com/nexus/content/groups/public
typesafe-ivy-releases: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
sonatype-oss-releases
maven-central
sonatype-oss-snapshots
- IDEA->
Preferences
->BuildTool
->sbt
->VM parametes
添加
-Dsbt.override.build.repos=true
-Dsbt.repository.config=~/.sbt/repositories
方法二:設(shè)置代理(解決)
注意:sbt會(huì)自動(dòng)使用IDEA的代理設(shè)置,如果sbt可用那就不需要單獨(dú)為sbt設(shè)置代理句旱,但是由于sbt特別需要https代理阳藻,所以大多數(shù)時(shí)候需要單獨(dú)設(shè)置。
IDEA的代理設(shè)置
1.使用socks代理(未解決)
IDEA->Preferences
-> BuildTool
-> sbt
-> VM parametes
添加
-DsocksProxyHost=127.0.0.1
-DsocksProxyPort=7070
理論上講直接使用socks代理是最方便的谈撒,但我在使用的過(guò)程中未連接成功腥泥。
2.使用http+https代理(解決)
非常重要!必須同時(shí)設(shè)置http和https代理啃匿,單獨(dú)一個(gè)仍然不行蛔外。(或許只用https也行)
IDEA->Preferences
-> BuildTool
-> sbt
-> VM parametes
添加
-DhttpProxyHost=127.0.0.1
-DhttpProxyPort=7890
-DhttpsProxyHost=127.0.0.1
-DhttpsProxyPort=7890
sbt的代理設(shè)置