忽略编译错误 - Java
我有大约 1500 个文件要编译,其中 15-20 个文件有编译错误.这些文件不在我的控制之下,所以我无法进行任何修改/更新/删除.所以,我有两个问题.
I have around 1500 files to compile, in which 15-20 files have compilation errors. These files are not under my control, so I could not do any modification/update/delete. So, i have two questions here.
1) 我如何忽略这 15-20 个文件中的编译错误并继续为其余文件生成 .class 文件.是否有任何 javac 命令行选项或任何会忽略编译错误并为所有其他非错误文件生成 .class 文件的东西.
1) how do i ignore the compilation errors from these 15-20 files and continue to produce the .class file for rest of them. is there any javac commandline option or anything which will ignore the compliation errors and produce the .class files for all other non error files.
2) java 编译器会在看到这些错误后立即中止编译,还是会继续编译(生成 .class 文件)其他所有内容,最后抱怨这些文件有错误.
2)will the java compiler abort compilation as soon as it sees these errors or will it continue compiling(producing .class files) everything else and at the end then complain about these files with errors.
推荐答案
你可以使用Eclipse.它的内部编译器——至少在某些情况下——能够继续构建的其余部分,即使某些类没有完全编译.如果可能,它甚至会为损坏的类生成类文件,生成在调用时立即抛出异常的方法.
You can use Eclipse. Its internal compiler is - at least in some cases - able to keep going with the rest of the build, even when some classes don't compile fully. It will even produce class files for the broken classes if possible, generating methods which throw an exception as soon as they're called.
我会强烈建议您简单地复制所有源代码并至少在您自己的副本中尽早修复错误,但 Eclipse 的部分编译可能 帮助你.
I would strongly recommend that you simply take a copy of all the source and fix the errors at least in your own copy as early as possible, but Eclipse's partial compilation may help you.
相关文章