posts - 495,comments - 227,trackbacks - 0
http://stackoverflow.com/questions/4150776/debugging-scala-code-with-simple-build-tool-sbt-and-intellij

idea下调试scala Web的设置
1、Make sure you have sbt.Revolver in your project/plugsin.sbt file e.g.

addSbtPlugin("io.spray" % "sbt-revolver" % "0.7.2")

2、Set javaoptions in you build.sbt(or build.scala) file:
javaOptions := Seq("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005")

In particular use the suspend=y option. This will hold the app until you connect a remote debugger from Intellij

3、Set up a debugger configuration in Intellij via Run / Edit Configurations menu. Press the + button, select the "Remote" option. Make sure the entries match the javaoptions above, in particular the port address of 5005. Give the config a name like 'Spray'.

4、From your SBT console use the re-start command. You should see the 5005 port address in the feedback output.

5、In Intellij set your breakpoints.

6、From Intellij, select the Run \ Debug 'Spray'. This should connect to the spray-can web server. You should be able to see a lot of threads in the debug window.

7、Beware that some of the Get directives in Spray seem to get executed on start up but not repeatedly on calling the website.
posted on 2015-08-31 10:55 SIMONE 阅读(308) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: