在 Maven 站点生成的 html 中添加到 JavaDoc 的动态链接
我想知道是否有一种方法可以通过 maven 站点插件自动创建指向它生成的 html 中的某些 JavaDoc 结构(如类)的链接。
作为我的意思的一个例子,Doxygen 提供了一种通过使用 doxy 协议来做到这一点的方法。您可以像这样创建一个锚点:
<a href="doxy://class/ExampleClass">ExampleClass</a>
然后,当您运行 Doxygen 时,它将用对包含 ExampleClass 文档的相应 html 文件的引用来替换 doxy:// 引用。这样,如果此类或其文档的位置发生更改,我不需要记住返回并修复链接,因为 Doxygen 会在下一次构建时自动更改它。
Maven Site 在导航栏中生成并提供了一个指向 JavaDoc 索引的链接,并且 JavaDoc 中存在链接到实际源代码的链接,但我希望将对文档中的类所做的任何引用都转换为指向该类的链接class' JavaDoc,而不必担心如果情况发生变化,在未来版本中保持最新状态。
这可能吗?或者我被硬编码的链接困住了?
提前致谢!
I am wondering if there is a way through the maven site plugin to have it automatically create a link to some JavaDoc structure (like a class) within the html it generates.
As an example of what I mean, Doxygen provides a way to do this through using the doxy protocol. You can create an anchor like such:
<a href="doxy://class/ExampleClass">ExampleClass</a>
Then, when you run Doxygen, it will replace the doxy:// reference with a reference to the appropriate html file containing the documentation of ExampleClass. This way, if the location of this class or its documentation ever changed, I wouldn't need to remember to go back and fix the link, as Doxygen will change it automatically on next build.
Maven Site generates and provides a link to the JavaDoc index in the navigation bar, and there are links in the JavaDoc that link to the actual source code, but I was hoping to turn any references I make to classes within the documentation into links to that class' JavaDoc without having to worry about keeping it up to date in future releases if things change.
Is this possible? Or am I stuck with hard coded links?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知, Doxia 使用的内容生成框架本身并不支持这一点Maven 和任何 Doxia 模块。所以我想你必须“硬编码”你的链接。
如果您使用 APT,请注意 Doxia-1.1(Maven >= 2.1.x 使用)对原始 APT 格式进行了一些增强。关于链接:
虽如此,解决方案可能是使用包含在中的 宏机制多克西娅。但您必须为此功能编写自己的宏。不过,这应该不会太难,请检查 源存储库中的现有代码。
To my knowledge, this is not natively supported by Doxia, the content generation framework used by Maven, and any of the Doxia Modules. So I guess you'll have to "hard code" your links.
If you use APT, note that Doxia-1.1 (used by Maven >= 2.1.x) incorporates some enhancements to the original APT format. Regarding links:
Having that said, a solution might be to use the macro mechanisms included in Doxia. But you'll have to write your own macro for this feature. It shouldn't be too hard though, check existing code in the source repository.