sbt换源


sbt换源

两种方法不一定都能用

方法一

Linux系统,则进入Bash执行如下命令:

cd  ~
mkdir  .sbt
cd  .sbt

然后创建 repositories 文件内容如下,并将文件拷贝到 .sbt 目录下

[repositories]
local
huaweicloud-maven: https://repo.huaweicloud.com/repository/maven/
maven-central: https://repo1.maven.org/maven2/
sbt-plugin-repo: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]

打开 sbt-1.3.0/conf/sbtopts 文件(不同机器位置不同,请自行寻找),在末尾新增一行,内容如下:

-Dsbt.override.build.repos=true

方法二

下载sbt-launch.jar包

wget http://maven.aliyun.com/nexus/content/repositories/central/org/scala-sbt/sbt-launch/1.3.10/sbt-launch-1.3.10.jar

解压并对其中的./sbt/sbt.boot.properties文件进行修改,在[repositories]处改为以下内容,增添一条阿里云镜像

unzip -q ./sbt-launch.jar
vim ./sbt/sbt.boot.properties
 
[repositories]
  local
  aliyun: http://maven.aliyun.com/nexus/content/groups/public/
  central: http://repo1.maven.org/maven2/

重新打包

jar -cfM ./sbt-launch.jar . #在主目录下进行

检验sbt是否可用

./sbt version


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM