简体   繁体   中英

How to attach source in Eclipse project for lib with no “sources JAR”?

I'm aware that this answer is a generally-accepted method for attaching sources for 3rd party JARs in Eclipse. However, I'm following the instructions and they're not working for me.

I'm trying to attach the source for JASIG CAS (version 4.0.0, so the CAS-4.0.0 link ). When you download and extract this ZIP, it has the following directory structure:

cas-server-4.0.0/
    cas-management-webapp/
        ...lots of source files
    cas-server-core/
        src/
            main/java/
                ...lots of Java sources --> these are the .java files I want to attach as source
            site/
            test/
        pom.xml
    ...lots of other dirs that start "cas-server-*"

So the CAS project consists of a bunch of JARs; the main one being cas-server-core . I want to attach the Java source for this JAR only. However, there is no compiled cas-server-core-source.jar here, just the exploded source files.

I'm looking for the exact instructions for attaching these sources so that when I run a debugging session in Eclipse, the debugger can find the sources and jump into them.

So far, I've tried:

Right-click my project >> Properties >> Java Build Path >> Libraries >> Add External JARs

I then selected the cas-server-4.0.0-release.zip . Then:

Under cas-server-4.0.0-release.zip Library, Select "Source attachment" >> Edit >> External location >> select the location of the cas-server-core/src directory

This isn't working. I'm wondering, do I need to first compile a cas-server-core-source.jar ? If so, what does the directory structure of that JAR need to be.

In any event, how do I actually go about attaching the source for this JAR?

I just tried it in my workspace and was able to resolve the source files properly. The trick is that when you select the external location, you should pick the 'external Folder' instead of 'External File'.

I selected the External Folder with path cas-server-4.0.0/cas-server-core/src and it worked.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM