I have a Gradle Spring Boot API Project and another Maven Project which I build as Artifact into a .jar file and import into my API Project as a Module. After doing that, everything works fine but the Javadoc comments that I made in the Maven Project for all the Services and Methods are not being preserved when I look at the methods in API Project. Is there a way to bring the Javadoc comments over to the API project?
-
Do you generate a javadoc artifact with the code artifact? – Thorbjørn Ravn Andersen Oct 09 '21 at 08:47
-
No, I just have Javadoc comments on my code in the Artifact, I do not have anything separate called Javadoc artifact. Is that something I have to do? – StackOverthrow Oct 09 '21 at 19:15
-
Yes. Generate and attach the javadoc before publishing. – Thorbjørn Ravn Andersen Oct 09 '21 at 19:28
-
Thanks, @ThorbjørnRavnAndersen for pointing me in the right direction, I figured it out and posted a descriptive answer for others to refer to. – StackOverthrow Oct 11 '21 at 16:58
-
Have a look at https://stackoverflow.com/q/21904269/53897 – Thorbjørn Ravn Andersen Oct 11 '21 at 19:37
1 Answers
After some research, I figured out a way to do this. Posting it here, just in case someone else needs help regarding it.
First of all, you need to add a Javadoc plugin (this will create a .jar file for the Javadoc) to the project which is supposed to be packaged into a .jar file to be imported into another project.
In the project where you need to import the *.jar files: Go to File -> Project Structure -> Modules (in the side navigation bar) -> Dependencies -> Find the .jar that you have imported want to attach the Javadoc to -> Right-Click then "Edit"
A new window opens, click the "+" button if your Javadoc is *.jar file and then find that *.jar add it there. If it is a link then add the link symbol and insert the link.
This should establish the connection between module *.jar file and its Javadoc *.jar file, which also enables the description (from Javadoc) of imported methods and classes in the quick preview while hovering over the method's instance.
Reference: https://stackoverflow.com/a/91514/15743238

- 65
- 8