简体   繁体   English

调试Scala项目(IntelliJ Idea 12和sbt)

[英]Debugging a Scala project (IntelliJ Idea 12 and sbt)

I've seen a few articles describing how to debug Scala applications, but nevertheless I want to ask it again due to the reason that all those articles are outdated and all things change very quickly in Scala world. 我已经看过一些文章描述了如何调试Scala应用程序,但是我想再问一遍,因为所有这些文章都已过时,所有内容在Scala世界中都发生了很快的变化。

I use IntelliJ Idea 12 + sbt (not a plugin, a plugin doesn't work for some reason). 我使用IntelliJ Idea 12 + sbt(不是插件,插件由于某种原因不起作用)。

So how do I do that nowadays ? 那么,如何做到这一点越来越大呢?

IMO, you are best off keeping SBT and Intellij separate, as they are two different concerns. IMO,你最好将SBT和Intellij分开,因为它们是两个不同的问题。 One is for building, and the other is for developing. 一个是建筑,另一个是开发。

Here are the steps that I typically go through to get a solid Scala/Intellij development environment up and running for a new Scala project. 以下是我通常要为新的Scala项目启动并运行可靠的Scala / Intellij开发环境的步骤。

  • Step 1: Install Scala Intellij Plugin 第1步:安装Scala Intellij插件
  • Step 2: Create a simple sbt project - details here 第2步:创建一个简单的sbt项目 - 详细信息请参见此处
  • Step 3: Add the fantastic sbt-idea plugin to your sbt config 第3步:添加梦幻般的sbt-idea插件到你的sbt配置
  • Step 4: sbt gen-idea 第四步: sbt gen-idea
  • Step 5: Open project in Intellij 12 第5步:在Intellij 12中打开项目
  • Enjoy debugging, syntax highlighting, code assist and all of the other nice IJ features. 享受调试,语法高亮,代码辅助和所有其他不错的IJ功能。

On the sbt side, I typically keep a terminal open, with sbt running so that I can rapidly test things outside the context of Intellij. 在sbt方面,我通常保持终端打开,sbt运行,以便我可以快速测试Intellij上下文之外的东西。

HTH HTH

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM