javaeclipseeclipse-3.4ganymede

Attach Source Issue in Eclipse


In Eclipse (Ganymede) I'm debugging some code that uses Apache Commons HttpClient and would like to step into the HttpClient code. I've downloaded the source code and tried to attach it in the normal fashion (CTRL-click on the method name and use the Attach Source button). I've tried to attach both as external file and external folder with no success. I've attached source before with no issues and can currently step into Hibernate source code successfully.

I've even tried editing the .classpath file directly to add sourcepath manually. Still no luck. Refreshing the project, doing a clean build, closing and re-opening Eclipse do not solve the issue. Frustratingly, Eclipse provides no error message; it just does not attach the source.

Here are the entries in .claspath:

<!-- Hibernate. Works -->
<classpathentry kind="lib" path="/myEAP/EarContent/APP-INF/lib/hibernate.jar" sourcepath="D:/Data/Download/hibernate-3.2.2.ga/hibernate-3.2/src"/>

<!-- Commons HttpClient. Will not attach -->
<classpathentry kind="lib" path="/myEAP/EarContent/APP-INF/lib/commons-httpclient.jar" sourcepath="D:/Data/Download/commons-httpclient-3.1/src/java"/>

I've tried changing the path to D:/Data/Download/commons-httpclient-3.1/src and that does not work either.

The directory structure is:

D
  Data
    Download
      commons-httpclient-3.1
        src
          java
            org
              apache
                commons
                  httpclient
                    AutoCloseInputStream.java
                    ... (and so forth)

Solution

  • Try pointing it at a directory containing the top level package directly, "D:/Data/Download/commons-httpclient-3.1/src/java" for you. What worked for me was creating a new src zip file containing the "org" folder and everything beneath it.

    Here's my .classpath entry, (which works for me) in case it helps:

    <classpathentry kind="lib" path="/blib/java/commons-httpclient-3.1/commons-httpclient-3.1.jar" sourcepath="/blib/java/commons-httpclient-3.1/commons-httpclient-3.1-src.zip"/>