Run code regardless of errors in unrelated files
Hello,
I'm reposting here the question[1] I recently posted on stackoverflow because I wasn't satisfied with answer I got there.
One thing that I miss from Eclipse is that I can't run code for testing various things (think short main()) if some totally unrelated files in my project contain errors. I've read in FAQ that I can use Eclipse compiler with -proceedOnErrors argument but it still doesn't work. Temporarily fixing unfinished code to compile is not really what I want.
Mr. Vic told me that I could uncheck Make before launch and manually compile and run individual files but it's not too much user-friendly. If I wanted to test something from multiple files I would have to compile them all manually. Sometimes I forget to compile. I have to do it for each file.
Things I test are usually some small snippets of code. For example sometimes I want to make sure that I understand API of some library correctly so I play a little bit in some short main().
Is there any other way?
Thank you.
[1] http://stackoverflow.com/questions/10851880/intellij-idea-run-code-regardless-of-errors-in-unrealted-project-files
请先登录再写评论。
You can create a separate module that doesn't depend on your main project and put your little snippets of code there. Then you'll be able to run them even when your main project does not compile.
Also, the Eclipse compiler with the -proceedOnErrors option is supposed to work; I don't know why it doesn't work for you.
Hello. Thank you for advice.
Unfortunately it doesn't work (it's -proceedOnError without trailing 's'). When I do Ctrl-Shift-F10 on Java file without errors and main function, make fails and IDEA shows me list of compilation errors in bottom window and points editor to first file with error(s). I've just tried it with jdk1.7.0_05 with Java 7 language level and jdk1.6.0_33 with Java 6 language level (both from Oracle).
Compiler settings (I also tried to select Generate no warnings):
After trying to run file in project with errors:
I have latest EAP community edition of IDEA (117.499). Should I report it as bug to YouTrack or JIRA?