简体   繁体   English

IntellIj IDEA无法找到源文件

[英]IntellIj IDEA cannot find source files

I'm trying to attach sources for this library called FileDrop so I can view documentation. 我正在尝试附加名为FileDrop的库的源代码,以便查看文档。 When I click Attach Sources... and select the directory with the source code, nothing changes. 当我单击Attach Sources ...并选择包含源代码的目录时,没有任何变化。 It still has the Sources not found message at the top of the class. 它仍然在类的顶部找到Sources not found消息。 However, in my external libraries section, if I manually expand the library jar file, I can view the original source in there. 但是,在我的外部库部分,如果我手动展开库jar文件,我可以在那里查看原始源。 I think this is because the library jar has the full, uncompressed source in it. 我认为这是因为库jar中有完整的,未压缩的源代码。

The zip file of the library has this structure after downloading and extracting it: 下载并解压缩后,该库的zip文件具有以下结构:

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. 这两个.java文件也在jar文件中。 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. 因此,当我在IDEA中创建一个库时,jar会出现在我创建的库下的外部库中,但源不会。

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. 在Project Structure - > Libraries屏幕中,它显示了Classes下的jar文件,它显示了Classes和Sources下的父目录(filedrop-1.1),但它显然没有检测到其中的任何源。 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. 这是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. jar文件包含两个不同的FileDrop类,一个在默认包中,另一个在net.iharder.dnd包中,这似乎是一个较新的版本。 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). 它还包含两个源文件(Example.java和FileDrop.java),其中第二个似乎是该类旧版本的源代码(默认包中的一个)。

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. http://iharder.cvs.sourceforge.net/viewvc/iharder/filedrop/net/iharder/dnd/上的CVS存储库似乎包含新版本的代码,因此您可以执行CVS签出并附加iharder /结帐时的filedrop目录作为库的源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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