sbt默认源基本是连不上的,安装完Scala,idea(idea要装scala插件)和sbt后,要在sbt文件夹和idea设置中进行配置
本机安装sbt路径为D:/sbt
安装完sbt后,进入conf文件夹,修改repo.properties(没有的话新建)为(添加阿里云的镜像)
[repositories]
local
aliyun: http://maven.aliyun.com/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为
# Set the java args to high
-Xmx512M
-XX:MaxPermSize=256m
-XX:ReservedCodeCacheSize=128m
# Set the extra SBT options
-Dsbt.log.format=true
-Dsbt.boot.directory=D:/sbt/data/boot/
-Dsbt.global.base=D:/sbt/data/.sbt
-Dsbt.ivy.home=D:/sbt/data/.ivy2
-Dsbt.repository.config=D:/sbt/conf/repo.properties
-Dsbt.repository.secure=false
配置完后,在cmd中运行一次sbt,sbt文件夹下会自动生成data,sbt配置完毕
复制sbtconfig内容到idea中setting->buildtools->sbt的vm parameters 并修改launcher为..../sbt/bin/sbt-launch(从安装的sbt启动),并勾选Settings中的use sbt shell for build and import
idea引入assembly时注意要对应sbt版本