-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve our approach to javadoc linking #130
Comments
But sadly, 231 links takes ages... see #130.
Because we proxy a few of the javadoc link targets, any time any of those proxied sites go offline (which has happened a few times now), it impacts builds and releases, which I find undesirable and counterintuitive—and unnecessary, because steps we take to address this issue here could also avoid the problem of link targets going offline. While I still think it would be most correct, and super slick, to enhance the maven-javadoc-plugin to add |
This issue has been mentioned on Image.sc Forum. There might be relevant details there: |
There is now a repository called javadoc-wrangler intended to improve this situation. See the README for details. It's not fully tested and working yet, but I anticipate it will solve all four of the problems described above. |
The pom-scijava-base ancestor POM includes configuration hardcoding several links for the javadoc tool. This configuration makes classes for SciJava-based projects clickable, pointing uniformly to javadoc.scijava.org endpoints aggregating multiple components. For example, the URL https://javadoc.scijava.org/SciJava/ includes javadoc for many components in the scijava GitHub org with groupId
org.scijava
. The general pattern is "Maven groupId = GitHub org = javadoc.scijava.org endpoint".Problems
Reproducibility. The javadoc.scijava.org endpoints are not reproducible. They are like SNAPSHOTs, always serving the latest javadoc. Properly, we should be linking to stable API javadoc corresponding to the versions depended upon by each built project. Otherwise, rebuilding the javadoc later will produce a different result, and potentially javadoc build errors if e.g. a class was later removed.
Performance. The more
<link>
entries hardcoded by pom-scijava-base, the longer everyone's javadoc builds take, because the javadoc tool scrapes the index from each linked URL.Extensibility. Projects wanting to extend their javadoc with links other than what pom-scijava-base hardcodes must add those links manually to their project POMs.
Separation of concerns. The pom-scijava-base should not be hardcoding links related to components from the pom-scijava BOM. Or to put another way: the list of javadoc links should be defined here in pom-scijava, and fully correspond to all the components managed here.
Solutions
How to extend a project POM with more links
The following block adds more javadoc URL links:
How to achieve link reproducibility
Note the use of the wonderful
javadoc.io
service to link reproducibly to individual component javadoc available from Maven Central! I thinkjavadoc.io
is the nicest way forward for reproducible javadoc permalinks. We don't have to deploy our own javadoc infrastructure—just continue working toward publishing as many of our artifacts as possible to Maven Central as they mature.How to balance javadoc build times with correct linking
Firstly: we shouldn't unilaterally add javadoc links for the entire component collection. I tried updating pom-scijava to use granular javadoc.io links instead of our fuzzy aggregating javadoc.scijava.org links. This changed the configuration from 37 unstable (javadoc.scijava.org) links to 231 stable ones (javadoc.io). Unfortunately, javadoc build time appears to scale pretty much linearly with this number: 0 links -> 11s; 37 links -> 48s; 231 links -> 215s.
Therefore, every project should include links in its javadoc configuration matching its direct dependencies. (Assuming a project's dependencies are structured correctly, with
mvn dependency:analyze
not reporting problems: transitive dependencies are not part of the project's public API, and thus no such links will be needed for that project's javadoc.)It would be nice is the maven-javadoc-plugin had a feature that did this automatically. The
<detectLinks>
option is almost what we need—but because there is no way to know what remote javadoc URL you want for each givengroupId:artifactId
dependency, it uses a simple heuristic,${project.url}/apidocs
, which will fail for the vast majority of components.Conclusion
We could enhance the maven-javadoc-plugin to support configuration declaring a mapping from groupId:artifactId to javadoc link URL, with the
<detectLinks>
feature using this mapping preferentially when discerning the links. For performance, we would need to double check that<detectLinks>
only includes links for direct dependencies, not transitive ones—or else add a flag controlling this behavior.The text was updated successfully, but these errors were encountered: