Idea does not show class source code in third party jar

Answered

 I've deployed some jar to my private maven nexus, but when I import these jars, Idea does not show the source code of the classes in that jar. for example

and I do have the source code

I can find them in "Libraries"

 

How could this problem happen?

 

This is not a common issue, some of the other third party jar just work fine. And some of them have this problem

6 comments
Comment actions Permalink

If you publish the sources of the library in the Maven repository, you can use Download Sources button in the Maven Projects tool window, IDE will download the source jars automatically and configure them as the sources location for the libraries.

If you don't have the sources for the library in the Maven repository, this behavior would be expected.

-1
Comment actions Permalink

Yes I've tried to use Download Sources button, but it did not work, it just do nothing for me. And I do have the source jar in my local repository (.m2/repository)

0
Comment actions Permalink

What's the name of the source jar in your local repository? What's the name of the source jar in IDEA library configuration? Your screenshot is cut, so it's not clear.

Can you share both source jar and the library jar so that we can verify them? What class are you trying to view the source for?

0
Comment actions Permalink

OK this is the problem jar and all the classes in it can not show the source code. And Sorry the jar is my private repository you can't find it in the public maven repo.

 

 

0
Comment actions Permalink

To understand the problem we need to verify the folders structure and the contents of the sources jar. It could be packaged incorrectly or missing some files.

0
Comment actions Permalink

Thanks Serge, I've check the source jar and I found the folder structure is wrong. I've compact all the package into one single dir name.  /main/java/com.xxx.xxx/MyClass.java 

0

Please sign in to leave a comment.