Liftã®å ¥éï¼intellijã§ã®éçºç°å¢ç·¨ï¼
â»2011/4/17è¿½è¨ jrebelãã©ã°ã¤ã³ã®è¨å®ãããã¦ããã®ã§è¿½è¨ãã¾ããã
liftã§éçºç°å¢ãæ´ããéã«ç¥ããªãã¨æéããããã®ã§ã¾ã¨ãã¦ããã¾ããããã§ã¯intellijãå©ç¨ãã¾ãã
IDEã¯intellijã®ä»ã«ã¯EclipseãNetbeansãensimeãªã©ãããã¾ãããã«ããã¼ã«ã«ã¯ãsbtã¨mavenãããã¾ããæã¯mavenã§ããããæè¿ã¯sbtã®å©ç¨ãæ¨å¥¨ããã¦ããããã§ãã
ä»åæ§ç¯ããç°å¢ã®ãã¼ã¸ã§ã³ã¯ä»¥ä¸ã®éãã§ãã
intellijï¼10
sbtï¼0.74
liftï¼2.3
scalaï¼2.8.1.final
注ï¼OSã¯Macãå©ç¨ãã¦ãã¾ããWindowsç°å¢ã¨ã¯å¤å°ç°ãªãé¨åãããã¾ããWindowsã§ãæ§ç¯ããã¨ããããã¾ããåé¡ãªãã¨æãã¾ãã
intellijã®ãã¦ã³ãã¼ã
intellijã以ä¸ã®ãµã¤ããããã¦ã³ãã¼ããã¾ãã
http://www.jetbrains.com/idea/download/index.html
intellijã«ãã©ã°ã¤ã³ã®ã¤ã³ã¹ãã¼ã«
intelljã§Intellij IDEA>Preferencs>Pluginsãé¸æãã¾ãã
Pluginsã®Availableã¿ããéãã¦ãæ¤ç´¢çªã«scalaã¨å
¥åãã¦ä»¥ä¸ã®ãã©ã°ã¤ã³ãã¤ã³ã¹ãã¼ã«ãã¾ãã
jrebelãã©ã°ã¤ã³ãã¤ã³ã¹ãã¼ã«ãã¾ãã
â»jrebelã¨ã¯ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãï¼jettyã¨ãï¼ãåèµ·åããã«ã³ã¼ãã«å¤æ´ããã£ãå ´åã«èªåã§åèªã¿è¾¼ã¿ããã¦ããããã¼ã«ã§ãã
jrebelã®å ¥æã¨jrebelãã©ã°ã¤ã³ã®è¨å®
jrebelã¯http://www.zeroturnaround.com/jrebel/ãããã¦ã³ãã¼ããã¾ãã
jrebelãã©ã°ã¤ã³ã®è¨å®ããã¾ããã¡ãã¥ã¼ã®IntelliJ IDEA>Preferencesã§jrebelãé¸æãã¦ä¸è¨URLããå
¥æããjrebel.jarã®ãã¹ãæå®ãã¾ãã
liftã®ãã©ã³ã¯ããã¸ã§ã¯ãã®å ¥æ
liftã®ãµã¤ã(http://liftweb.net/)ãããã©ã³ã¯ããã¸ã§ã¯ãããã¦ã³ãã¼ããã¾ãã
ã¢ã¼ã«ã¤ãã解åããã¨ããã¤ãããã¸ã§ã¯ããå
¥ã£ã¦ãã¾ããDBæ¥ç¶ãããããªãlift_basicãlift_xhtml辺ããããã¨æãã¾ããlift_blankã ã¨DBæ¥ç¶ã®è¨å®ãããã¦ããªãã§ãã
ãã©ã³ã¯ããã¸ã§ã¯ãã®ä¿®æ£
intellijã§åãè¾¼ããããã«ããã«ã¯ããã¤ã追å ï¼ä¿®æ£ãå¿ è¦ã§ãã
1.sbt-idea-pluginã®è¨å®
intellijã§å©ç¨ããããã«å¿
è¦ãªãã©ã°ã¤ã³ããã¦ã³ãã¼ãããè¨å®ãè¡ãã¾ãã
[ããã¸ã§ã¯ã]/project/plugins/Plugins.scalaãä½æãã¾ãã
Plugins.scala
import sbt._ class Plugins(info: ProjectInfo) extends PluginDefinition(info) { val sbtIdeaRepo = "sbt-idea-repo" at "http://mpeltonen.github.com/maven/" val sbtIdea = "com.github.mpeltonen" % "sbt-idea-plugin" % "0.4.0" }
sbt-idea-pluginã¯ç¾å¨0.4.0ãææ°ã§ãã0.5ãéçºä¸ã¿ããã§ãã
project/build/LiftProject.scalaã®ä¿®æ£
intellijã«åãè¾¼ãããã®è¨å®ã追å ãã¾ãã
ãä¿®æ£åã
class LiftProject(info: ProjectInfo) extends DefaultWebProject(info) {
ãä¿®æ£å¾ã
class LiftProject(info: ProjectInfo) extends DefaultWebProject(info) with IdeaProject {
sbtãå©ç¨ãã¦intellijããã¸ã§ã¯ãã®ä½æ
ã¿ã¼ããã«ã§ããã¸ã§ã¯ãã®ç´ä¸ã«ç§»åãã¾ãã
sbt.shãããã¾ããwindowsã®å ´åã§ãsbt.batãããã®ã§åæ§ã«åãã¾ãã
$sbt (sbtãèµ·å)
>update
>idea
ideaã¨å ¥åããéã«ãideaãªãã¦ç¥ããªããï¼ãã¨è¨ãããå ´åã¯ããã©ã³ã¯ããã¸ã§ã¯ãã®ä¿®æ£ããã¾ããã£ã¦ãããããã©ã°ã¤ã³ããã¦ã³ãã¼ãåºæ¥ã¦ããªãå¯è½æ§ãããã¾ããè¨å®ãè¦ç´ãã¦ãã ãããããã§ããã¡ãªãã¨ããããsbtã§ãcleanãããã¦ãå度ãupdateãããã¦ã¿ã¦ãã ããããããããããã¾ãããããããã¾ããã
ããã¸ã§ã¯ãã®åãè¾¼ã¿
ããã¸ã§ã¯ããåãè¾¼ãã«ã¯ãintellijã§File>OpenProjectããä½æããããã¸ã§ã¯ããé¸æãã¾ãã
ãã°ããããã¨åãè¾¼ã¾ãã¾ãããã®éã«æã
ã¨ã©ã¼ãã¤ã¢ãã°ãåºåããããã¨ãããã¾ããåé¡ãªãããã§ããããã¤ãã½ã¼ã¹ãéãã¦ã¿ã¦ã¨ã©ã¼ãåºã¦ããªããã¨ã確èªãã¦ãã ããã
ã¢ããªã®åä½ç¢ºèª
intellijã§[ããã¸ã§ã¯ã]/src/test/RunWebAppãé¸æãã¦å³ã¯ãªãã¯ãããRun with JRebel "RunWeebApp.main"ããé¸æãã¦ãã ããã
ä¸é¨ã®ã³ã³ã½ã¼ã«ç»é¢ã«ãã°ãåºåããã¾ããåé¡ãªããã°ãhttp://localhost:8080ã§ç»é¢ã表示ãããã¨æãã¾ãã
éçºæã®æ¹æ³
ç§ã®å ´åã¯ãã³ã³ã½ã¼ã«ã§sbtã§ã~compileããå ¥åãã¦ããã¦ãã½ã¼ã¹ã®ä¿®æ£ããã£ãå ´åã«èªåã§åã³ã³ãã¤ã«ããã«ãã¦ãã¾ããåæã«intellijã§ã¯ãRunWebAppã§ã¢ããªã±ã¼ã·ã§ã³ãµã¼ããèµ·åãã¦èªåã§åæ ãããããã«ãã¦ãã¾ãããã®æ¹æ³ãªãinttelijã®ãããã°ã«ã対å¿ãããã¨ãåºæ¥ã¾ããintellijã§ã®ãããã°ãä¸è¦ãªãsbtã®ã~jetty-runãã ãã§ã大ä¸å¤«ã§ãã
â»sbtã§ã®ã~compileããªã©ã¯ãã¡ã¤ã«ã«å¤æ´ããã£ããããä¸åº¦è¡ãããã«ããè¨å®ã§ãã
ãããã«
ç¾æç¹ã§ã¯intellijãéçºç°å¢ã§ã¯ä¸çªè¯ãã¨æã£ã¦ãã¾ãããç¾å¨ãã¼ã¿çã®Scala IDE for Eclipse辺ãã®ååãè¦å®ã£ã¦ãã¾ããé²åãæ©ãã®ã§ã©ã®IDEããããã¯ã¾ã ã¾ã 注ææ·±ãè¦å®ã£ãæ¹ãè¯ãã¨æãã¾ãã
The Scala IDE for Eclipse beta 2 available now!
http://www.scala-lang.org/node/9222
以ä¸ã§intellijã§ã®éçºç°å¢ç·¨ãçµããã¾ãã