I checked the manual of javadoc and read some posts here on stackoverflow (for example Including images in javadocs) but was unable to get a satisfactory result
I want to provide an image inside my javadoc that should be packaged with the created html. Here are the steps I take:
- create a
doc-files
directory belowsrc/main/java
(this is a gradle project in STS) - place a file named
classhierarchy.png
into the freshly created directory - add
<img src="doc-files/classhierarchy.png">
to the javadoc of my classde.company.some.more.levels.MyClass
- create the javadoc
I can see that the png file gets copied to C:\temp\NameOfProject\doc\doc-files but it can't be displayed because the img-link is relative to the package: c:/temp/NameOfProject/doc/de/company/some/more/levels/doc-files/classhierarchy.png
I know that I could fix this by prefixing the path with many /../../ but I would have to adapt this if the package depth changes:
<img src="../../../../../../doc-files/classhierarchy.png">
The second thing I don't like is the fact that directory doc-files is in the same path my source code is.
How can I link and provide the images elegantly ?