Compile just what's needed and ignore compile errors elsewhere
已回答
I frequently write unit tests as I'm developing to test bits of code I'm writing.
I'm finding it very tedious that in order to run the unit test I need to recompile EVERYTHING. Is there a way to make it compile only what is needed.
I usually include the source code from other projects to make debugging easier, but this usually stops me from running any unit tests as I can't compile unless I go to the effort of adding the dependancies for all projects I've included.
So at the moment if I want to write and run unit tests the first thing I have to do is remove a whole bunch of src directories from my project so I can actually compile and run the tests.
I'm sure I'm missing something, there has to be an easier way.
Cheers,
Pete
请先登录再写评论。
I'm with Pete on this one. I work on a project that consists of several modules, many of which depend several others. I'd like to see IDEA compile just what is needed as very often I write a simple test case that only depends on a class that doesn't depend on other stuff. Yet, this class is part of a module that depends on other modules, which in turns triggers compilation of lots of code when only two classes really needed to be compiled...
You can exclude the code that doesn't compile from the compilation.
File | Settings | Build, Execution, Deployment | Compiler | Excludes:
There is an option to use "Make, no error check" instead of "Make" action in Run/Debug configuration.
Hello ProggerPete,
The compilation in IDEA works per module. In a run configuration, you specify
the "Use classpath and JDK of module" option, and before running the tests
IDEA compiles the specified module and all its dependencies.
If you include source code of other projects as separate modules and don't
add any dependencies from your module with unit tests to those modules, they
won't be compiled when you run the tests.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Yes, very annoying. I am writing a simple unit test which I cant check whether it is working because of some other classes that my test does not uses and is failing compiling.
Can you show us how to do please?
I think the OP was looking for a flag like "Ignore compile errors that don't impede my unit test"
Can't seem to find it ...
AHA! Thanks a lot!