IDEA Scala sbt配置

*本文針對Mac下的開發環境配置html

1.安裝java

Mac自帶了的JDK6,安裝在目錄:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/下.本身安裝的JDK默認路徑爲:/Library/Java/JavaVirtualMachines/.java

java9和scala2.11會有兼容性的問題,因此要設置爲java8.git

2.安裝scala

spark用的仍是scala 2.11,因此安裝了scala 2.11和2.12 ,要把當前版本設置爲2.11github

3.設置環境變量

在'~/.bash_profile'文件中添加以下內容bash

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中添加一樣的內容maven

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'文件,裏面內容以下:oop

[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修改源ui

hostspa

使用國內maven源編譯java以及sbt.net

添加全局鏡像庫

設置IDEA

相關文章
相關標籤/搜索