Test resources folder precendence #3006
Replies: 2 comments
-
Depending on ordering of classpath entries is a call for trouble. If you assume a single file (e.g. you don't explicitly handle all files/resources with a specific name) you should not have two of them on the classpath. The simplest solution is to use a different file name in the tests. |
Beta Was this translation helpful? Give feedback.
-
Just to call this out again, if you deploy your application in the common "folder full of jars" format, exactly which jar appears first in the classpath would depend on filesystem ordering, which is variable across different operating systems and even different filesystems within the same operating system. That means which In my work codebase we have a linter that fails if there is classpath conflicts, after getting bitten by this sort of problem one too many times. Perhaps we should add such a feature opt-in to Mill as well |
Beta Was this translation helpful? Give feedback.
-
Hi Mill,
It sounds like the
resources
has no precedence on the library it depends on...Here an example
When I run my test (JUnit5 => java code integration) and I load the property file then I get the content from
But if I run the test in Intellij I get the correct behavior.
I wonder what is the precedence of the
resources
folder in the classpath?Or maybe I'm doing something wrong :'(
Thanks
Beta Was this translation helpful? Give feedback.
All reactions