无法在IntelliJ + sbt-idea-plugin中调试Scala应用程序 [英] Can't debug a Scala application in IntelliJ + sbt-idea-plugin

查看:504
本文介绍了无法在IntelliJ + sbt-idea-plugin中调试Scala应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用IntelliJ Idea 12,sbt和 IntelliJ的SBT插件。


I'm developing a Scala application using IntelliJ Idea 12, sbt and sbt-idea plugin. I generated all necessary files by saying "gen-idea" and everything goes well -- I was able to compile the sources in command line in sbt as well in IntelliJ Idea 12 itself using menu Build->Make Project.

Here is my main class (Application.scala)

object Application extends App {
  val a = 12345
  println("application entry point 1235")
}

I have a breakpoint at val a = 12345.

1) There were other errors before, but now says "Module is not specified". How do I solve this?

I'll be posting updates since there would be other errors as my gut tells me.

解决方案

To debug just like to run, you need to create a run configuration (menu Run -> Edit Configurations). If you haven't done yet, you need to add an Application entry with the + button.

Not only do you need to specify the main class, but also which "module" that class belongs to. By default, "Use classpath of module" will be empty. Here in the popup menu, you need to select the main module (not the one ending in "-build"). After you choose that and close with "Ok", it should work.


Although not necessary, I also recommend to use sbt for building instead of "Make". In the configuration in the "Before launch" part, select "Make" and click on "-", then click on "+" and choose sbt -> test:products.

Edit: Here is the reference for the SBT plugin for IntelliJ.

这篇关于无法在IntelliJ + sbt-idea-plugin中调试Scala应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆