在IntelliJ IDEA中启用部分编译 [英] Enable Partial Compilation in IntelliJ IDEA

查看:1844
本文介绍了在IntelliJ IDEA中启用部分编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在IntelliJ中启用部分编译?

How do I enable partial compiles in IntelliJ?

NetBeans中的同一个功能,一个人可以在一个类中运行一个main方法而不需要在同一个项目中具有非依赖性,也需要编译。

The same feature in NetBeans where by one can run a main method in a class without having non-dependecies in the same project be required to also compile.

编辑:

执行CrazyCoder建议后,取得了一些成功,现在我在尝试运行不相关的文件时遇到ClassNotFoundException那些没有编译的。修复非编译文件后,它运行正常。

After performing what CrazyCoder suggested, with some success, now I get ClassNotFoundException when trying to run a file not associated with those that were not compiling. After fixing the non-compiling files, it runs just fine.

我实际上在同一个非编译文件中出错以进行测试,但它仍然有效。

I actually made in error in the same non-compiling file to test and it still works.

可能这是一个错误吗?

编辑:

以下说明仍无效。

推荐答案

IntelliJ IDEA不欢迎处理无法编译的项目,但有几种选择:

IntelliJ IDEA doesn't welcome working on the project that fails to compile, but there are several options:


  • 使用文件/文件夹上下文菜单中的编译操作,在运行/调试配置中禁用生成
  • 运行/调试配置的启动前部分中的
  • 删除生成并添加生成,无错误检查。现在开始配置,它将忽略试图在任何被编译的类上运行的编译错误。

  • use Compile action from the file/folder context menu, disable Make in Run/Debug configuration.
  • in the Before launch section of the Run/Debug configuration remove Make and add Make, no error check instead. Now start the configuration and it will ignore compilation errors trying to run on whatever classes managed to compile.

你应该注意Make会失败在第一个错误,并不会尝试进一步。在这种情况下,您应该使用显式编译操作。 Make还会删除有错误的源的输出类文件。

You should note that Make will fail on the first error and will not try to proceed further. In this case you should use explicit Compile action. Make also deletes output class files for the sources with errors.

如果要在错误后继续编译,则应切换到IntelliJ IDEA中的Eclipse编译器设置 | 编译器 | Java编译器。选择Eclipse编译器时,出现错误选项出现,默认情况下启用。使用 Eclipse编译器,启用 时启用生成,无错误检查选项,您应该获得所需的行为。

If you want compilation to proceed after errors, you should switch to Eclipse compiler in IntelliJ IDEA Settings | Compiler | Java Compiler. When Eclipse compiler is selected, Proceed on errors option appears and it's enabled by default. With Eclipse compiler, an option to Proceed on errors enabled and Make, no error check in Before launch section you should get the desired behavior.

这篇关于在IntelliJ IDEA中启用部分编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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