简体   繁体   中英

IntellIj IDEA cannot find source files

I'm trying to attach sources for this library called FileDrop so I can view documentation. When I click Attach Sources... and select the directory with the source code, nothing changes. It still has the Sources not found message at the top of the class. However, in my external libraries section, if I manually expand the library jar file, I can view the original source in there. I think this is because the library jar has the full, uncompressed source in it.

The zip file of the library has this structure after downloading and extracting it:

filedrop-1.1
    Example.java
    filedrop.jar
    FileDrop.java

So the source files do not have any package...not sure if that is part of the problem. The two .java files are also in the jar file. So when I create a library in IDEA, the jar shows up in External Libraries under the library I created, but the source does not.

In the Project Structure -> Libraries screen, it shows the jar file under Classes, and it shows the parent directory (filedrop-1.1) under both Classes and Sources, but it is apparently not detecting any sources within them. This is the screen where I've been trying to add the sources, and they show up here as expected, but apparently no sources are found.

This is IntelliJ IDEA 13.1.4.

The packaging of this library is extremely weird. The jar file contains two different FileDrop classes, one in the default package and another in the net.iharder.dnd package, which seems to be a newer version. It also contains two source files (Example.java and FileDrop.java), the second of which seems to be the source code of the old version of the class (the one in the default package).

The CVS repository at http://iharder.cvs.sourceforge.net/viewvc/iharder/filedrop/net/iharder/dnd/ seems to contain the new version of the code, so you can do a CVS checkout and attach the iharder/filedrop directory from the checkout as sources to the library.

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