Scalaã§ã³ã¼ããæ¸ãæã¯ãæè¿ã¯æ» æ³Emacsï¼sbtãªãã¨ãå¤ãã®ã§ããçµ±åéçºç°å¢ã使ãæã¯EclipseãããIntelliJã使ããã¨ã®æ¹ãå¤ãã®ã§ãIntelliJã使ã£ãå ´åã®fscããã³sbtã使ãæé ãè¼ãã¦ããã¾ããâ¦èªåã®ã¡ã¢ã¨ãã¦ã
ã¾ãããã®ã¨ããã¯ä»äºã®é½åã§Eclipseãå¼·å¶ããã¦ããã®ãã¡ãã£ã¨æ®å¿µãªã®ã§ããã
ã¾ãã¯ããã©ã°ã¤ã³ã®ã¤ã³ã¹ãã¼ã«ãã¡ãã¥ã¼ã®ãFileãâãSettingsããé¸ãã§ãIntelliJã®è¨å®ç»é¢ãèµ·åããã®ä¸ãããPluginsããã¯ãªãã¯ãããã©ã°ã¤ã³ä¸è¦§ã®è¡¨ç¤ºãçµãã£ã辺ãã§ãAvailableãã¿ããé¸ã³ãScalaã¨sbtã®ãã©ã°ã¤ã³ãããããã¤ã³ã¹ãã¼ã«ãã¾ãããã¼ã¯ã¼ããscalaãã§æ¢ãã¨ãããã«è¦ã¤ããã¨æãã¾ãã
ãã¨ã¯ãå³ã¯ãªãã¯ãã¦ãDownload and Installããã¤ã³ã¹ãã¼ã«ãçµããã¨ãIntelliJã®åèµ·åãä¿ãããã®ã§ããã«å¾ã£ã¦åèµ·åã
Scalaã®ã³ã¼ãã¹ã¿ã¤ã«ã®è¨å®ã¨ãã¯ãã好ã¿ã§ã
ã¾ãã¯ãæ®éã«ããã¸ã§ã¯ããä½æãã¾ããããã¸ã§ã¯ãã使ãScalaãæå®ãã¦ãã ãããã
â»ãªãããã®æãCreate compiler libraryãã¨ãCreate standard libraryãã®é
ç®ãLevelãã«ãglobalãæå®ãã¹ããproject-levelãæå®ãã¹ããã¯ã¤ãã¤ãããããªãã¾ããâ¦
ãç¡é§ã«Global Libraryãå¢ãã¦ãã¾ããã¨ãå¤ãã®ã§ãproject-levelãæå®ãããã¨ã®æ¹ãå¤ãã®ã§ãã
fscç·¨
IntelliJã§fscã使ãæ¹æ³ã¯ãã©ãã2段éãããããªã®ã§ãããå¾è ã®æ¹ã¯ãªããé«éåãæããªãã£ãã§ããâ¦ãä¸å¿ã両æ¹ç´¹ä»ãã¦ããã¾ãã
ãSettingsãããfscãèµ·åãã
ããã¸ã§ã¯ãã®è¨å®ã¨ãã¦ãfscãå©ç¨ããæ¹æ³ã§ããã¡ãã¥ã¼ã®ãFileãâãSettingsãããè¨å®ç»é¢ãèµ·åãã¾ããç¶ãã¦ããCompilerãâãScala Compilerããé¸æã
ããã¦ããUse fsc(fast scalac)ãã«ãã§ãã¯ãå
¥ãã¾ããããã§çµäºã§ãã
ååã¯ã©ã¤ãã©ãªãå ¨ã¦èªã¿ã«ããã®ã§é ãã§ããã2åç®ä»¥éã¯é«éã«åä½ããããã«ãªãã¾ãã
ããã»ã¹ã¨ãã¦ãæ示çã«fscãèµ·åãã
ç¶ãã¦ãå®è¡è¨å®ãå¤æ´ãã¦fscãæ示çã«ããã»ã¹èµ·åããæ¹æ³ã§ããã¡ãã¥ã¼ã®ãRunãâãEdit Configurationsããé¸æããå®è¡è¨å®ãèµ·åãã¾ãã
ããã§ãDefaultsããé¸ã³ãï¼ãã¿ã³ãæ¼ãã¾ãã
ããã¨ãå·¦ã«ãAdd New Configurationããå±éãããã®ã§ããã®ä¸ãããScala Compilation Serverããé¸ã³ã¾ãã
追å ããããScala Compilation Serverãã®è¨å®ã«ãé©å½ã«ååãä»ãï¼ããã§ã¯fscã¨ãã¦ãã¾ãï¼ããBefore launchãã®ãMakeããããã§ãã¯ãå¤ãã¦OKãã¿ã³ãæ¼ä¸ã
æå¾ã«ãfscãæ示çã«èµ·åãã¾ãã
fscãèµ·åããããèµ·å対象ãé常ã®Scalaã¯ã©ã¹ãªã©ã«æ»ãã¦ããã¾ãããããå¿ãã¦Runããã¨ããã£ã±ãfscãèµ·åãã¾ããâ¦ã
ã§ãããã®å¹æãªã®ã§ãããã©ããï¼ï¼ã¨ãã£ãæãã§ããä»ã®ãµã¤ãã§ã¯ãSettingsãã§è¨å®ããfscã¨ã»ããã§å©ç¨ããã¨ãã£ãæãã§æ¸ããã¦ãã¾ããããããããSettingsãã§fscã使ããã¨ã«ãã¦OKãæ¼ãã段éã§ãããã»ã¹ãè¦ãã¨fscèµ·åãã¦ã¾ãããã
åè ã ãã§ããã®ããã
sbtç·¨
IntelliJã®sbtãã©ã°ã¤ã³ãã¤ã³ã¹ãã¼ã«ãã¦ãç°¡åãªè¨å®ããããããã«ä½¿ããããã«ãªãã¾ãã
ã¾ãã¯ãã¡ãã¥ã¼ã®ãFileãâãSettingsããé¸æãã¦ãè¨å®ç»é¢ãèµ·åãç¶ãã¦ãSBTããé¸ã³ããIDE Settingsãã®æ¬ã®ãSBT launcher JAR fileãã«ãã¼ã«ã«ã«ãã¦ã³ãã¼ããã¦ããsbtã®JARãã¡ã¤ã«ã¸ã®ãã¹ãããVM parametersãã«ã¯sbt-launch.jarãèµ·åããJavaVMã¸ã®ãã©ã¡ã¼ã¿ãè¨å®ãã¾ãã
sbtãã©ã°ã¤ã³ãã¤ã³ã¹ãã¼ã«ãããç¶æ ã§ããã¸ã§ã¯ããéãã¨ãä¸ã®æ¹ã«ãSBT Consoleãã表示ããã¦ããã¨æãã®ã§ããããéãç·è²ã®åçãã¿ã³ãæ¼ãã¨sbtãèµ·åãã¾ãã
ãã®ç¶æ
ã§ãcompileã¨ãrunã³ãã³ãã¯å©ç¨ã§ããã®ã§ãããsbtã使ãã¨å®ã¯IntelliJã§è¨å®ããScalaã®ãã¼ã¸ã§ã³ã¨ãã¯è¦ã¦ããã¾ããããã£ã¦ãbuild.sbtãä½æãã¾ããä½æããããSBT Consoleã§reloadãã¾ãããã
ããã§ä¸å¿ã¡ããã¨è¨å®ã§ãã¾ããã
ãããã®ç¶æ ã§Runããã¨ãsbtã¯ã¹ã«ã¼ããã¦ãã¾ãé常ã®scalacãèµ°ã£ã¦ãã¾ãã¾ãã
å®è¡æã«sbtçµç±ã§Runãããããå¤æ´ãã¦ã¿ã¾ããããèµ·å対象ã®ã¯ã©ã¹ã®ãRun/Debug ConfigurationsããéãããBefore launchãã®é¨åã®ãMakeãã®ãã§ãã¯ãå¤ããRun SBT Actionãã«ãã§ãã¯ãå
¥ãã¾ãã
ãRun SBT Action â¦ãã®ç®æã¯ããcompileãããããè¨å®ãã¦ããã¾ãããã
ããã§ã次åããRunæã«ã¯sbt compileãèµ°ã£ãå¾ã«èµ·åããããã«ãªãã¾ããsbtã使ã£ãã³ã³ãã¤ã«ã¯Scalaã®ã³ã³ãã¤ã«ã¨ãã¦ã¯çéãªã®ã§ãããã¯ããã§å¿«é©ãªã®ã§ããã©ã¾ã åé¡ãã
ãã®ã¾ã¾ã ã¨ãæ®éã«Runããã¨sbtãåºåããã¯ã©ã¹ãã¡ã¤ã«ã®é ç½®å ã¨IntelliJãæå¾ ããã¯ã©ã¹ãã¡ã¤ã«ã®å ´æããºã¬ã¦ããã®ã§åããã¦ãããå¿ è¦ãããã¾ããã§ãªãã¨ãRunã³ã³ã½ã¼ã«ã«åºåãããçµæãããããâ¦ã¨ããããå¤ãå 容ãåºåããããã¨ã«ãªãã¾ããè£ã®SBT Consoleã§ã¯ããã¡ãã¨ã³ã³ãã¤ã«ããã¦ããã®ã«ãã
ã¨ããããã§ããProject Structureãã®ãModulesããé¸ã³ããPathsãã®ãUse module compile output pathããsbtãåºåãããã¹ã«åããã¦ããã¾ãããã
ããã§ãã¡ããã¨åãããã«ãªãã¾ãããã£ã¨ã