Idea 9.0.2 Can't find library source

I added a new library .jar file to my project's classes and a different .jar file for its sources.  When I navigate to the class, Idea can't find the sources.  I've tried exploding the source jar and even the class jar.  I've even had them co-located in the same hierarchy so the .class and .java files were together to ensure it wasn't a hierarchy issue.  I even went so far as to completely delete my ~/Library/Caches/IntelliJIdea90 and rebuild it.  But none of these get me sources to go along with the classes.

I have numerous other libraries and sources set up the same way without troubles.  

Is there any logging I can get IntelliJ to spit out that might give a hint at what it's trying to do and what might be going wrong?  And if so, in what log would it appear?

> uname -a

Darwin xxxx 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386


Any other ideas?

Thanks,
Dan
9 comments

Are you sure you attached the source as source?

Each library has separate categories of resources (JARs, dirs or URLs) for: a) compiled code; b) source; c) annotations; d) documentation. Make sure the source JAR is attached as source.


Randall Schulz

0

Yep.  I used the "Attach Sources..."  button and it appears in the "Sources" folder in the libraries tab.

0

Did you look inside that source JAR and make sure everything is in order? The right sources in the right places?


RRS

0

Hi Dan,

You can check the configuration using the following approach:

  1. Suppose you assume that spring-context source files are attached. Let's check that for 'ApplicationContext' class. Type 'Ctrl+N' and navigate to the target class ('library-config1.png');
  2. Check that target class is opened at IDEA editor and it doesn't have a source attached, i.e. only fields/methods signatures are represented ('library-config2.png');
  3. Press 'Alt+F1' and select 'Project View' option ('View -> Select In' main menu option) and press <enter> ('library-config3.png');
  4. You can check now what jar/IDEA library is used ('library-config4.png');


Denis



Attachment(s):
library-config4.png
library-config3.png
library-config2.png
library-config1.png
0

Yep.  I've even exploded the two jars into the same directory and ensured that the .java and .class files are co-located.  I've also tried the setup with exploded jars co-located as well as in separate class and src directories.

0

Thanks Denis,

That's all good and matches my setup.  The problem is that no matter how I try I can't get sources associated with a library.  I have my spring sources and classes in separate jar files and they work.  I have the mysql classes and sources in separate jars and they work.  It's just this last library that I added that refuses to associate sources with the class files.

Dan

0

Am I right assuming that you performed the actions I mentioned and checked that your module uses *.class file from the same IDEA library that was used during source attaching?

You can create minimal but complete standalone example that illustrates the problem (archive that contains IDEA project, library and sources) and submit it to IDEA tracker then. We'll sort that out.

0

Yes I did.  It took me a while to parse what you were asking because I only have one library defined for the project and I dump all the jars, classes, and sources for third-party libraries into it.  But it did get me thinking.  I created a new library, added the .jar file (didn't attempt to attache sources), removed the jar file from the main library and now IntelliJ doesn't even know about the classes in the jar.  The same thing happened in a smaller project.

0

Have you configured the library as dependency for your target module?

0

Please sign in to leave a comment.