windows上搭建sbt和scala环境:
首先下载 然后离线安装scala插件,再在本地安装scala和sbt
sbt版本要注意最好和linux服务器上的一致,编译所依赖的包全部都在linux服务器上面,不建议将/root目录下面的.ivy2目录下的cache目录整个拷贝到windows上来,最好联网自动去下载
sbt的话可以直接将linux上的sbt安装目录拷贝过来,主要就是bin和conf目录,bin目录里面sbt-launch.jar包是依赖的sbt包
注意修改配置conf目录下的sbtconfig.txt文件可参考我的配置:
# Set the java args to high
-Xmx512M
-XX:MaxPermSize=256m
-XX:ReservedCodeCacheSize=128m
-Dsbt.ivy.home=D:\Software\sbt\ivy2_cache_backup
# Set the extra SBT options
-Dsbt.log.format=true
加红的地方就是刚才将sbt依赖库cache目录(默认本地仓库)拷贝过来的地址(最好配置在D盘以免重启后丢失),这个的话在intellij ide里面的sbt配置中也可以进行配置具体参考下面图片:
修改sbt远程镜像地址:
(1)sbt的安装目录中找到sbt-launch.jar包,利用压缩工具打开盖jar包,找到\sbt\sbt.boot.properties文件
[scala]
version: ${sbt.scala.version-auto}
[app]
org: ${sbt.organization-org.scala-sbt}
name: sbt
version: ${sbt.version-read(sbt.version)[0.13.11]}
class: ${sbt.main.class-sbt.xMain}
components: xsbti,extra
cross-versioned: ${sbt.cross.versioned-false}
resources: ${sbt.extraClasspath-}
[repositories]
local
local-repository: http://172.7.1.216:8081/nexus/content/groups/public
aliyun-maven: http://maven.aliyun.com/nexus/content/groups/public
maven-central
typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
sbt-ivy-snapshots: https://repo.scala-sbt.org/scalasbt/ivy-snapshots/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
[boot]
directory: ${sbt.boot.directory-${sbt.global.base-${user.home}/.sbt}/boot/}
[ivy]
ivy-home: ${sbt.ivy.home-${user.home}/.ivy2/}(可改成与上面提到的sbt的conf目录下sbtconfig.txt文件中一样的内容)
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}
加红的地方就是修改添加的默认远程仓库地址,建议打开文件时使用notepad++,修改完毕后,在压缩包工具中右击编辑使用note打开,将刚才的修改复制进去即可(否则可能会无法保存修改结果,kill掉javaw进程即可)
在未联网的windows IDE环境下测试多次,始终有个问题,每次会先访问本地,然后访问maven-central,无论怎样更改远程镜像地址的顺序或者直接删除maven-central选项都不行!!!!!
(2)