Surefire classlaoder loads wrong class when classes are of same package/class
name
----------------------------------------------------------------------------------
Key: SUREFIRE-289
URL: http://jira.codehaus.org/browse/SUREFIRE-289
Project: Maven Surefire
Issue Type: Bug
Components: classloading
Affects Versions: 2.0 (2.2 plugin)
Environment: Windows, Cygwin
Reporter: Zachary Jones
This is a repeat of the comment in SUREFIRE-286
I am having a problem with surefire classloading.
I had to hack the ServiceMix class:
org.apache.servicemix.http.processors.ConsumerProcessor.
I saved the hacked version as the same class name and the same package. This
class does compile to target/classes. The ServiceMix jar that contains this
class is included in my classpath after the target/classes directory (seen with
-X)
When running mvn test, I get a test failure for the Test class that tries to
create a ConsumerProcessor. We are expecting it to create "our" version of
ConsumerProcessor, but it instead creates the ServiceMix version.
I have tried all the available usage options from the surefire plugin
documentation to no avail. Through debug in Eclipse, I see through a watch
expression (getClass().getClassLoader()) is always the IsolatedClassLoader, no
matter what options we set.
This test passes in Eclipse, so I am pretty sure it is a classloading issue
with the surefire plugin.
Thanks for your help in advance.
--
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