Anyone generating and publishing javadoc for a mul...
# community-support
t
Anyone generating and publishing javadoc for a multi-project build? How do you create links from one subproject to another? I've found https://github.com/SgtSilvio/gradle-javadoc-links which automatically sets up javadoc.io links, and (more importantly to me) resolves element-list and/or package-list from JARs to use with
-linkoffline
, which should cover the case for when a subproject depends on another (the javadoc.io link for that version doesn't exist yet as it's being generated before publishing) Do you know of other plugins? Do you have other approaches to handle that situation?
Just found https://kordamp.org/kordamp-gradle-plugins/#_org_kordamp_gradle_javadoc that apparently works similarly (with special treatment for javaee, spring and a few other dependencies/javadoc links; but applies itself to subprojects among other things I dislike)
v
That's just the usual aggregation situation actually. Make an outgoing variant in the dependency project that publishes
javadoc.destinationDir
with a task dependency to
javadoc
. In the dependent project consume that variant and use that directory as second argument to
linksOffline
.
I'm exclusively using
linksOffline
now since javadoc.io became unstable
But I don't use something that derives an
element-list
, but I store them with the project code in VCS. If you derive from something you never know whether there will be dead links, because for example only a subset of classes in a JAR could be part of the JavaDocs.
I store the
element-list
per version and if I update a library, the build fails and tells me to also update the
element-list
to the appropriate version.
t
Do you happen to have a publicly available example of that kind of setup? (fwiw, and iiuc, the gradle-javadoc-links doesn't derive the element-list (from the library JAR), but resolves (extracts) it the javadoc JAR, and it defaults to linking to javadoc.io which uses the same source; so there's no additional external dependency at build time because the JARs come from the same servers as other dependencies, and there shouldn't be broken links as javadoc.io and the plugin use the same inputs)
(all of this feels quite hackish anyway; I'll probably go with the "most hackish" but most lightweight approach of committing the element-list files to the repository, including for the library itself, because I only have one project depended on by the others, with only one package, so feels easier to just have a fixed element-list than set up an additional variant and set up the consumer project to use it)
v
Unfortunately, no