I'm using a maven project. When I do a clean install with maven, all my tests pass.
When I try to run my unit tests directly without cleaning my target folder first, they pass too.
When I run a clean on my project, and then try to run the unit tests, they fail, because the tests can't find my spring config (applicationContext.xml) file on the classpath.
A look into the target folder revealed it hadn't been copied there.
The JUnit run config is set to Build, Activate tool window before launch.
Preferences > Build, Execution, Deployment > Compiler has a tick on Clear output directory on rebuild (which is why I don't understand that a mvn install followed by running unit tests works).
Project structure > Modules > <my module> > Sources correctly shows the Resources folder set to src/main/resources and the Test Resources folder to src/test/resources (which is why I don't understand why the xml files aren't copied over). The target folder is set as excluded.
The java files do get compiled as expected and copied into target/ when I run the tests after a mvn clean - which is why I don't think it is an output directory issue...
Any idea why this isn't working for me? :)
I'm running 2017.2.2 Ultimate, and execute all maven commands via IntelliJ's maven panel...