[ http://jira.codehaus.org/browse/SUREFIRE-475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dan Fabulich closed SUREFIRE-475. --------------------------------- Resolution: Cannot Reproduce As mentioned, we've got an integration test checked in that verifies this behavior explicitly. If it's not working for you, then please reopen this bug and provide a reduced test case demonstrating the problem, ideally in the form of a minimal Maven project that has the bug. > Classloader getResource() returns resource from wrong directory > --------------------------------------------------------------- > > Key: SUREFIRE-475 > URL: http://jira.codehaus.org/browse/SUREFIRE-475 > Project: Maven Surefire > Issue Type: Bug > Components: classloading > Affects Versions: 2.4.2 > Reporter: Alex Eagle > > 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": > {noformat} > |-- target/test-classes > | `-- foo > `-- some file > |-- target/classes > `-- foo > {noformat} > 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. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira