Summary: | dev-util/eclipse-sdk-3.4 : junit4 doesn't works due to hamcrest problem | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | mambro <mambro87> |
Component: | [OLD] Java | Assignee: | Java team <java> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | elvanor, gentoo, qnikst, spatz, steffen.weber |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | AMD64 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | 287757, 403161 | ||
Bug Blocks: | 296296 | ||
Attachments: |
class to test
test class |
Description
mambro
2008-02-07 17:30:23 UTC
We have junit-4.4 which normally bundles the hamcrest-core classes but ours doesn't. And the eclipse-sdk build doesn't handle indirect deps well. Also looked at junit.jar bundled in eclipse sources and there are also no hamcrest classes, which means they use older version (hamcrest was added only in 4.4). So in short, it needs to handle this indirect dep. But only Elvanor can know how :) Someone is working on the problem? There are some tests I can do to give a hand? Yes, I handle this bug, and actually I will probably work on this this week If you want to help, just create a junit4 test and attach it (as I never wrote junit tests yet). It should save me some time Created attachment 145133 [details]
class to test
Created attachment 145135 [details]
test class
Remember to add junit4 library to the classpath with right-click on the project -> Build Path -> Add Libraries -> JUnit4 Thank you OK, I got to work on this today. Unfortunately I cannot reproduce, with your test files the test works OK (note that I dont have much experience with JUnit tests, I just right clicked on the file and chose Run as JUnit test). This is strange because actually it should fail yes. We use the 4.4 junit version whereas Eclipse expects 4.3, and for 4.4 we do need the hamcrest dependency. I know how to fix this bug - only needs a test case to reproduce. So please try to provide me with some test that actually fail right now (maybe yours was too simplist so did not require hamcrest) and I'll fix it ASAP. Can anyone reproduce this bug on x86?? ali_bush maybe? Works for me Steps to Reproduce 1) Ok firstly. Had to reemerge eclipse and its dependencies as eclipse blowing up. 2) Created project. Added new class and new unit test. Copied example into each respectively. 3) Right click on test, select Run > Run Test. 4) It runs :D Sorry for bugspam. Versions of junit are equery list junit [ Searching for package 'junit' in all categories among: ] * installed packages [I--] [ ~] dev-java/junit-3.8.2-r1 (0) [I--] [ ~] dev-java/junit-4.4-r1 (4) I've manually added /usr/share/hamcrest-core/lib/hamcrest-core.jar to the build path and now it works.. What do you mean, you added hamcrest-core.jar to the build path? You mean the project build path?
That should still not be needed IMHO. So this is clearly a bug, but unfortunately I cannot reproduce it.
> I've manually added /usr/share/hamcrest-core/lib/hamcrest-core.jar to the build
> path and now it works..
>
Yes, I mean the project build path. At LAST I can reproduce the bug. I had an old version of junit-4 laying around, that actually contained the hamcrest classes embedded. So now that I can reproduce, I can fix it :) Hi, same bug here on x86. The bug occured on my laptop, but 2 other computers were not infected. First I build on my laptop and another computer the junit package. laptop -> /usr/share/junit-4/lib/junit.jar contains no hamcrest other computer -> /usr/share/junit-4/lib/junit.jar contains hamcrest ( same junit-4 version, junit-4.4-r1 ) So, i checked, that both portage trees were up to date -> exact same ebuild for junit. and then, i upgraded sun-jdk of the other computer from 1.6.0.03 to 1.6.0.05 and in junit.jar the hamcrest disappears, and the bug was on this computer, too. So the problem is, with sun-jdk 1.6.0.03 hamcrest was integrated in junit.jar, with sun-jdk 1.6.0.05 there was no integration of hamcrest in junit.jar. Perhaps this can help you. Same problem on x86. It started with the upgrade to sun-jdk/1.6.0.05 and can be worked around by manual adding /usr/share/hamcrest-core/lib/hamcrest-core.jar to the project build path. Has there been any progress? It's been more than 6 months since you said you'll fix it now that you can reproduce it, has something changed? I'm still having this bug on eclipse 3.4.1 with junit 4.5. (In reply to comment #17) > Has there been any progress? It's been more than 6 months since you said you'll > fix it now that you can reproduce it, has something changed? > I'm still having this bug on eclipse 3.4.1 with junit 4.5. > I think you will find the reason for there being a lack of progress, is the difficulty of finding the solution. This is the Workaround that ppl can use. ********************************************** *************WORKAROUND*********************** ********************************************** Add the jar /usr/share/hamcrest-core/lib/hamcrest-core.jar to your build classpath for any projects using junit4 tests. it could also be possible that you need /usr/share/hamcrest/lib/*.jar or other jars. In which case adding them as well will work. Yes, people should use the workaround for now. Due to the way Gentoo currently packages hamcrest and JUnit, this bug is very hard to fix. At first I thought we could fix it just by manipulating OSGi manifests, but I mailed the Eclipse people and it looks like a patch to the Eclipse code is needed - which does not look easy to write. This bug still exists on eclipse 3.5.1 (gentoo testing amd64) (In reply to comment #20) > This bug still exists on eclipse 3.5.1 (gentoo testing amd64) > Mmmm... could you provide more information please. Can you reproduce this with the attached Sum.java and SumTest.java. I just used these and it worked. Ok so I was able to reproduce and now have a patch to fix for eclipse to fix this. Now working in eclipse-3.5.1-r1. Need to file this upstream. This defect will be closed after a 3.5 release is stable. I'm using netbeans 6.9 and same problem is there maybe problem is not in eclipse. But in the way how junit is included in IDE. Now I'm using workaround: adding hamcrest junit library`s build path. This went stable long ago and is totally obsolete anyway. |