How do I configure JUnit's Source in Eclipse?
eclipse, java, junit
Solution
I downloaded the Eclipse SDK and checked the differences, and I finally got it to work.
Download this JAR into your `eclipse/plugins` directory.
Edit the file `source.info` in your `eclipse/configuration/org.eclipse.equinox.source` directory, and add the following line:
org.junit4.source,4.5.0.v20090423,plugins/org.junit4.source_4.5.0.v20090423.jar,-1,false
Open the file `artifacts.xml` in your `eclipse` directory, and add the following fragment:
<artifact classifier='osgi.bundle' id='org.junit4.source' version='4.5.0.v20090423'>
<properties size='2'>
<property name='artifact.size' value='128389'/>
<property name='download.size' value='128389'/>
</properties>
</artifact>
If Eclipse is already open, you'll need to restart it for the changes to be detected.
Note: For Eclipse 3.6 (Helios), you should use the updated JAR(s). See the comments by @Supressingfire and @Milo.
Note: on Eclipse 3.6(Helios), step 3 (artifacts.xml) is not necessary. Tested on Ubuntu Eclipse 3.6: Version: Helios Service Release 2 Build id: 20110218-0911
Problem
I am using Eclipse Galileo for Java EE, and I want to configure JUnit to show me the source code when I try to navigate to its methods. I've tried attaching source to the JUnit library, but the library definition is not editable. I cannot even find where to configure the JUnit library in the preferences. When I open the Add Library window and choose JUnit, I see a dialog where I can choose the JUnit version, but it shows that Source Location is "not found". How can I configure Eclipse to find JUnit's source?