文档上有写:
http://www.scala-sbt.org/0.13/docs/Launcher-Configuration.html
一开始以为是要配置conf
下的文件 sbt/0.13/conf/sbtopts
# Path to local Ivy repository (default: ~/.ivy2)
#
-ivy H:/repository/jar
但配置后无效,sbt启动下载的jar依旧是放在了~/.ivy2
中
最后发现文档中的配置文件是在sbt\0.13\bin\sbt-launch.jar
中的\sbt\sbt.boot.properties
中(可用rar解压工具直接打开修改并覆盖),修改后内容如下:
[scala]
version: ${sbt.scala.version-auto}
[app]
org: ${sbt.organization-org.scala-sbt}
name: sbt
version: ${sbt.version-read(sbt.version)[0.13.7]}
class: ${sbt.main.class-sbt.xMain}
components: xsbti,extra
cross-versioned: ${sbt.cross.versioned-false}
resources: ${sbt.extraClasspath-}
[repositories]
local
oschina nexus:http://maven.oschina.net/content/groups/public/
typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
maven-central
sbt-plugins-repo: http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
play: http://private-repo.typesafe.com/typesafe/maven-releases/
sonatype-snapshots: https://oss.sonatype.org/content/repositories/snapshots
[boot]
directory: ${sbt.boot.directory-${sbt.global.base-${user.home}/.sbt}/boot/}
[ivy]
ivy-home: H:\repository\jar
checksums: ${sbt.checksums-sha1,md5}
override-build-repos: ${sbt.override.build.repos-false}
repository-config: ${sbt.repository.config-${sbt.global.base-${user.home}/.sbt}/repositories}
也可以通过修改sbt.bat
(win下)的方式在启动命令后面加上参数指定。
不过对于第一个修改没有影响到仓库位置还是很诧异,注释上不是写了这个参数是仓库位置吗。或许是我理解错了。
PS:activator的默认位置也可以通过这样修改,文件在jar(例如:activator-launch-1.2.12.jar)中的路径是一样的。
转载自http://www.ituring.com.cn/article/132055