Library sources not included in JavaDoc

Answered

I'm using the "Generate JavaDoc" tool, and although the JDK docs are linked (using the link option), the documentation for my library (a library I created and included as a dependancy) is not. I want the JavaDoc form that library to be copied into this JavaDoc build.

 

Generate JavaDoc settings:

[x] Whole Project

[x] Include JDK and library sources in -sourcepath

[x] Link to JDK documentation (use -link option)

 

Under Project Settings > Libraries

I have a library which is contained in a .jar file which has both the binary and sources.

Classes:

(my project)/lib/(my library)-with-sources.jar

Source:

(my project)/lib/(my library)-with-sources.jar

JavaDocs:

(my project)/lib/(my library)-docs.zip

 

Under Project Settings > Modules > Dependancies

15 (java Version "15.0.1")

<Module source>

(my library) - set to "Compile", not Export

 

Under Project Settings > Modules > Paths > JavaDoc

(my library)-docs.zip is added

 

I can't find anything else anywhere in any of the settings which is missing to include but when I view the built JavaDoc for my project, any time there is a refer to one of the classes in my library there is no documentation, so instead of displaying "MyClass" as a clickable link to that page, it just displays "mycompany.foo.MyClass" as plaintext.

 

How do I make it copy my docs from my library to my project's docs? I can't find anything in any of the settings relating to docs or dependancies that I've missed.

0
3 comments

Hello,

Would it be possible for you to share your project with your current settings?

You can upload it privately to https://uploads.jetbrains.com/

1

I'm not able to share the entire project, but I was able to create the problem on a simpler example.

Upload id: 2021_02_22_TsivnES8TfDuQ78t (file: javadoc-problem.zip)

There are two separate project here: mylib and myproject. my project depends on mylib.

When I build the javadoc for myproject, and you check the acme.myproject.CatLoader class, the signature says it returns List<acme.mylib.Cat>, where "List" links to the Java 15 API (this works as it's just hyperlinking to the online docs), but acme.mylib.Cat is just plain text. But I want it to bundle in the docs for the dependancy so you can click this link. There is no online version of the library's docs I can link to, so I need to include it in the javadoc build here.

0

Does it help if you:

  • Close the project and the IDE
  • Remove all .idea folders and .iml files from project root and module directories
  • Remove both module-info.java files from the module directories
  • Launch the IDE, go to File | New | Project from Existing Sources, select the project folder, proceed with all defaults
  • Check if the 'Cat' link works?

It worked for me and I believe the culprit is module-info.java.

0

Please sign in to leave a comment.