hbm files aren't copied to target directory when running unit tests
I'm using IntelliJ 2017.2.3 Ultimate.
Our project has - for historical reasons - Hibernate mapping files under the source folder. Because of that, I seem unable to mark their containing directory as a Resource directory - I can only exclude it.
Preferences > Build > Compiler > Clear output directory on rebuild is selected
When I run a unit test (Before launch: Build, Activate tool window), the resource files aren't copied - causing failing tests, because changes aren't picked up.
It's a multi-module maven project. I don't want to build everything, and I'd rather not do a mvn clean install -DskipTests instead of a Build.
How can I fix the issue (and make IntelliJ copy the changed hbm files)?
Also, why is the target folder not cleared, even though the compiler settings say it should be?
请先登录再写评论。
You should configure Maven to handle resources located in the source directories like described at https://stackoverflow.com/questions/23289098/how-to-copy-resource-to-src-target-directory-with-maven.
Target directory contains not only the compiler output, but also artifacts. Clean action deletes compiler output only.
But if I run JUnit tests without running maven first, will IntelliJ honour the maven config, or not (i.e will the files be there or not)? :)
Yes, it will honor the configuration from pom.xml.