IDEA Scala sbt配置

*本文针对Mac下的开发环境配置

1.安装java

Mac自带了的JDK6,安装在目录:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/下.自己安装的JDK默认路径为:/Library/Java/JavaVirtualMachines/.

java9和scala2.11会有兼容性的问题,所以要设置为java8.

2.安装scala

spark用的还是scala 2.11,所以安装了scala 2.11和2.12 ,要把当前版本设置为2.11

3.设置环境变量

在'~/.bash_profile'文件中添加如下内容

export SCALA_HOME=/opt/scala/scala-2.11.12
export PATH=$PATH:$SCALA_HOME/bin
export JAVA_9_HOME=/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home
export JAVA_8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
export JAVA_HOME=$JAVA_8_HOME

装了zsh的话就在~/.zshrc中添加同样的内容

4.安装本地sbt
➜  ~ brew install sbt@1
Updating Homebrew...
==> Downloading https://github.com/sbt/sbt/releases/download/v1.0.3/sbt-1.0.3.tgz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/279553/d3e64dba-baad-11e7-972d-9974d629917f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIW
######################################################################## 100.0%
==> Caveats
You can use $SBT_OPTS to pass additional JVM options to SBT:
   SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"

This formula uses the standard Lightbend sbt launcher script.
Project specific options should be placed in .sbtopts in the root of your project.
Global settings should be placed in /usr/local/etc/sbtopts
==> Summary
?  /usr/local/Cellar/sbt/1.0.3: 494 files, 73.8MB, built in 23 seconds
➜  ~
5.添加全局镜像库

在'~/.sbt/'下添加一个'repositories'文件,里面内容如下:

[repositories]
local
aliyun: http://maven.aliyun.com/nexus/content/groups/public/
aliyun-ivy:http://maven.aliyun.com/nexus/content/groups/public/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
typesafe:http://dl.bintray.com/typesafe/ivy-releases/ , [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
ivy-sbt-plugin:http://dl.bintray.com/sbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
sonatype-oss-releases
maven-central
sonatype-oss-snapshots
参考:

sbt修改源

host

使用国内maven源编译java以及sbt

添加全局镜像库

设置IDEA

 

转载于:https://my.oschina.net/u/2935389/blog/1573232

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值