However, I wonder if I really want to share outputs. It’s not like I want to aggregate the outputs of individual javadoc tasks, as then the inter-project javadoc links would probably not appear.
I lately used io.freefair.aggregate-javadoc in my buildSrc migration branch, and it seems to do mostly what I want.
FTR, I also cross posted this question to Stackoverflow, because I believe many projects have an aggregated javadoc task like my javadocAll and may want to migrate to buildSrc at some point.
Again, whether you use buildSrc or not is absolutely irrelevant to your question.
And whether you use buildSrc or not is also irrelevant to your current approach being unsafe and bad practice.
I didn’t say that you should get the JavaDoc output from the other projects.
Getting the sources would also be an output.
Look at the things I gave you.
The aggregated JaCoCo report also needs the sources from the other projects and gets them also the proper way.