之前做過一個項目是用 sbt 管理依賴的,被坑得不要不要的。。
拉取依賴時總是提示無法連接,但用瀏覽器可以訪問相應的網站(typesafe, jcenter)
提示的錯誤為:
Server access Error: Connection timed out url=https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.8/ivys/ivy.xml
搗鼓了半天終於找到了解決的方法——將依賴包的地址改成http協議(默認是https的)
找到sbt-launch.jar, 用解壓工具打開,更改里面sbt目錄下sbt.boot.properties文件,把https協議改成http協議即可,如果還不行可以再加上
[repositories] local oschina: http://maven.oschina.net/content/groups/public/ //如果改成http不行的加上這句 jcenter: http://jcenter.bintray.com/ typesafe-ivy-releases: http://repo.typesafe.com/typesafe/ivy-releases/
更改后再重新打包即可。
如果用IDEA的話,在IDEA里下載好Scala的plugin,在路徑 \用戶\.IntelliJIdea15\config\plugins\Scala\launcher 下可以找到sbt-launch.jar,按上面的方法更改sbt的配置即可。
在ubuntu下路徑為
/home/username/.IntelliJIdea2016.1/config/plugins/Scala/launcher/sbt-launch.jar
使用 nautilus 路徑名 即可在該路徑打開資源管理器
參考鏈接: