[
http://jira.codehaus.org/browse/SUREFIRE-289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Zachary Jones updated SUREFIRE-289:
-----------------------------------
Attachment: cheesetest.zip
cheese.zip
Adding a test case to prove this problem.
First unzip the cheese.zip into your local repo. It contains a jar file at
cheese/org/cheeseburgertest-1.0.jar
cheeseburgertest-1.0.jar contains a class "test/TestClass" that has a method
String sayCheese() which returns "CheeseBurger!".
Unizip the cheesetest.zip anywhere and run "mvn install". cheesetest is a
simple project that contains a duplicate "test/TestClass" whose sayCheese
method returns "Cheese!".
When it runs the test "test/TestClassTest", it asserts that sayCheese returns
"Cheese!". But as you will see, the test fails and the surefire report shows
"CheeseBurger!" was returned instead.
If you do an eclipse:eclipse and run the test in Eclipse, the test will pass as
expected..
> 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
> Attachments: cheese.zip, cheesetest.zip
>
>
> 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