简体   繁体   English

在IntelliJ中运行时编译

[英]Compile on run in IntelliJ

When I run a test in IntelliJ, it doesn't automatically compile the file first. 当我在IntelliJ中运行测试时,它不会首先自动编译该文件。 Is this normal behavior? 这是正常的行为吗? I know I can use eclipse mode to auto compile when I save, but it seems logical to auto compile before running the file. 我知道我可以在保存时使用eclipse模式自动编译,但在运行文件之前自动编译似乎合乎逻辑。 Is this possible in IntelliJ? IntelliJ中有可能吗?

There is a "Before Launch" option group under configuration screen, that has "Make" as one of the options. 配置屏幕下有一个“Before Launch”选项组,其中“Make”作为选项之一。 If this option is checked, the whole module/project will be rebuilt prior launching. 如果选中此选项,则将在启动之前重建整个模块/项目。

If you want this option to persist for all future configurations automatically created by IntelliJ, mark it under relevant configuration in "Defaults" group. 如果希望此选项在IntelliJ自动创建的所有未来配置中保留,请在“默认值”组中的相关配置下标记它。

I have made a macro to Save and Compile mapped to CMD+s 我已经将一个宏保存并编译映射到CMD+s

Also made a macro to Save, Compile, and Run mapped to CMD+r 还将一个宏保存,编译和运行映射到CMD+r

EDIT: 编辑:

According to this link: http://blog.jetbrains.com/scala/2012/12/28/a-new-way-to-compile/ 根据此链接: http//blog.jetbrains.com/scala/2012/12/28/a-new-way-to-compile/

Using the SBT incrementality type rather than IDEA will better detect modifications to the scala files and function as we expect. 使用SBT增量类型而不是IDEA将更好地检测对scala文件的修改并按预期运行。

Preferences -> Build -> Compiler -> Scala 首选项 - >构建 - >编译器 - > Scala

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

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