tags:

views:

1031

answers:

2

I would like to upgrade the JUnit version of my Eclipse Galileo (on windows) to JUnit 4.8.1 instead of the included JUnit 4.5. There does not appear to be a plugin update to use the new version or a way to change the location of the JUnit 4 jars. How can I update to the new version and/or use a JUnit jar not under the eclipse install directory?

+1  A: 

For plain java projects

You could add the junit.jar you want to use as a file in your project, add it to the build path, and remove the eclipse defined junit library from the build path (assuming it was there).

For plugin projects

You can do as above or, create a new plugin from the junit 4.8 jar and add it to your test plugin's dependencies.

ChrisH
This is a plain java project. Will adding the updated JUnit jar as a Refrenced Library cause Eclipse to run JUnit tests with the runners and features from the updated JUnit? I don't think it will.
Andrew
No, I don't think it will affect the runner that the IDE uses, but I would expect that your test code would see the junit code from the reference library at run time. I guess it depends on what new features of JUnit you want to take advantage of.
ChrisH
A: 

Note: Eclipse Galileo 3.5.2 (just released today), and Eclipse Helios 3.6M5 (to be released) have JUnit4.8 in them.
See this Planning Meeting Notes from last January, 27th.

Darn... As The OP Andrew comments, the latest Eclipse 3.5.2 still got a JUnit4.5.
As stevendick adds: it shouldn't make it in the 3.5 release cycle, but should probably make it in the last 3.6Mx releases.

VonC
I have updated previously today, and am running 3.5.2r352 of org.eclipse.jdt my junit.jar in plugins is still 4.5.0
Andrew
I'd be surprised that a bug-fix release of Eclipse (3.5.2) contained such a major upgrade to junit - I'm doing an upgrade to check this now. You could call those planning meeting notes ambiguous on the item about JUnit 4.8.1 - I suspect it applies only to the 3.6 milestone.
hbunny
@stevendick: agreed. I just updated the answer to reflect just that.
VonC