How to get scratch files to execute independently of current project
Is there a way to get scratch files to execute without wanting to compile the existing project? I have been working on refactoring a project so have a lot of compile errors right now. However, I was wanting to test something real quick in a scratch file. The scratch file won't execute because of all the compile errors in the project. What is the point of scratch files if they aren't really independent of the current project?
请先登录再写评论。
I can suggest tweaking corresponding run configuration, section "Before launch". Change there "Make" action to "Make, no error check". That way the IDE will attempt to execute the scratch no matter if there were compilation errors.
You may also want to set a different context module in the run configuration: the IDE will try to make this module and its dependencies before execution
Agreed, I came to the same problem. Scratch files should be independent of the current project or at least we could choose if there were independent or not.
I strongly agree: I have a big complicated Maven built project. The simple "I just compile then start scratch" will never compile the project. Never. But it will always try, that's super annoying and completely unnecessary.
Even better: When it tries its cute little compilation attempt it can't find the generated files, so java files which were OK a moment ago are now flooded with red error markings because it can't find anything anymore. So compiling scratch files makes the IntelliJ state even worse.
https://youtrack.jetbrains.com/issue/IDEA-169325