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

查看:49
本文介绍了在 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.

会不会是bug?

按照说明操作仍然无效.

Followed instructions still not working.

推荐答案

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 Build in Run/Debug configuration.
  • in the Before launch section of the Run/Debug configuration remove Build and add Build, 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编译器Settings |编译器 |Java 编译器.选择 Eclipse 编译器时,会出现 Proceed on errors 选项,并且默认启用.使用 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 Build, no error check in Before launch section you should get the desired behavior.

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

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