Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
2.4.2
-
None
-
None
Description
In upgrading from version 2.3 to 2.4.2, we encountered a different behaviour in classloading. We have a classes/ and a test-classes/ folder under target, and both contain the same package, "foo":
|-- target/test-classes | `-- foo `-- some file |-- target/classes `-- foo
In 2.3, a Classloader.getResource() call in our app returns the target/test-classes/foo folder, in which we find some file.
In 2.4.2, the same code returns the target/classes/foo folder, and so some file cannot be found. Note that there are two actual directories that resolve to from same classpath location.
To get the classes folder in the classpath when running tests, we are using this testResources in the pom:
<noformat>
<testResources>
<!-- include the standard resource directory... -->
<testResource>
<directory>src/test/resources</directory>
</testResource>
<!--
... and include the resources from the real build, but give
precedence to any test resources with the same name (this is
accomplished by defining this testResource after the previous one.
-->
<testResource>
<directory>src/main/resources</directory>
</testResource>
</testResources>
</noformat>
Perhaps SUREFIRE-443 can provide a way to correctly copy resources between the classes and test-classes folders, so that there is only one location on the disk for each classpath URI.