I would like class B
to inherit the Javadoc from an interface that it implements, interface A
. I have included the source for interface A
in my Javadoc command, and class B
correctly inherits the documentation.
Now I'm wondering if I can make the links it generates point to interface A
's documentation on the web, rather than duplicating it on my site, i.e. the "Specified by:" links will link to an external page.
Is this possible?
Huge credit to Paŭlo Ebermann's answer for pointing me in the right direction for my set up. Please read that answer first as it makes sense of this while I am just providing an additional way to configure the solution.
So thought I'd share what I went with for anyone managing their project with maven and using maven-javadoc-plugin as part of their build process to generate their docs.
As part of the plugin's configuration you can specify a group of links to include. Here is the bit that specifically covers configuring links.
And here is a sample linking external documentation for selenium and java se for packaging in a jar to deploy with my project. The beauty is that these javadocs in my project just link out to the external ones seemlessly.
Btw, if you found anything on this page useful, please link to it somewhere. Finding this page on google was too difficult and this is a really nice thing to have.
It is possible, yes. For being able to include inherited documentation, the source of interface A has to be findable in the sourcepath of javadoc, but should not be in the list of packages passed to
javadoc
for documentation creation. For linking, use the-link
parameter. I just tried this (with the ant javadoc task):To command line javadoc, I think this translates like this (unix syntax, one line):
where
class B
is in packagecom.personal.myproject
,interface A
is in packagecom.example
,src
,../example-src/src
.In a example class created for this, javadoc would copy the documentation from
A.methodName()
toB.methodName()
, but link to the online documentation athttp://example.com/javadoc/com/example/A.html#methodName()
.Thanks for asking this question, I always wanted to do this :-)