如何查看已添加到 Maven 存储库的 javadoc?
我知道我可以使用 Maven 来提取工件的 javadoc(如果已添加),该工件应该以 JAR 的形式出现(对吗?),然后我可以将其解压并浏览。我的问题是,我试图找出一系列工件中的哪一个具有我正在寻找的特定包。我可以下载六个 javadoc 包,将它们全部解压,然后一次打开一个索引文件,但这听起来非常不愉快。
一定有更好的办法!我注意到 Nexus 支持 javadoc 工件浏览,但显然仅在 Pro 版本中(我们没有,而且不太可能很快得到)。我更喜欢 GUI 解决方案,尽管我会选择命令行答案,只要它是类似于 showmethedocs groupId:artifactId [version]
的内容。
ETA:澄清一下:我正在专门比较一个工件的多个版本,或者多个不同但相似的工件(“foo:core”与“foo:utils”与“foo:extra”或其他东西),当我不这样做时确定哪个工件实际上包含我需要的包/类。也许有更好的方法来做到这一点,但我问错了问题?如果我将每个工件添加为 Maven 依赖项并检查 Eclipse 中的文档,这可以工作,但如果某个工件有 20 个旧版本,并且其中一个恰好具有我正在寻找的方法,则可能需要一段时间。
I know I can use maven to pull the javadocs for an artifact (if they've been added), which should come through as a JAR (right?), which I can then unpack and browse. My problem is, I'm trying to figure out which of a series of artifacts have the particular package I'm hunting for. I could download a half-dozen javadoc packages, unpack all of them, then open the index files one at a time, but that sounds like it would be pretty unpleasant.
There must be a better way! I noticed that Nexus supports javadoc artifact browsing, but apparently only in the Pro version (which we do not have, and are unlikely to get any time soon). I'd prefer a GUI solution, though I'd settle for a command line answer, provided it's something along the lines of showmethedocs groupId:artifactId [version]
.
ETA: To clarify: I'm looking specifically to compare multiple versions of an artifact, or multiple different but similar artifacts ("foo:core" versus "foo:utils" versus "foo:extra" or something) when I'm not sure what artifact actually contains the package / class I need. Maybe there's a better way to do that, and I asked the wrong question? If I add each artifact as a Maven dependency and check the docs in Eclipse, that can work, but if there's 20 old versions of an artifact, and exactly one of them has the method I'm looking for, it could take a while.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果它是已发布到 Maven Central 的工件,您可以使用此 Web 服务:
http://www.javadoc.io
If it's for an artifact that's been published to Maven Central you can use this web service:
http://www.javadoc.io
如果您
运行mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true
从项目的根目录 ,它将下载所有源代码和文件。远程存储库上的 javadocs 到本地存储库。如果您有 m2eclipse,您可以在首选项中将其设置为在后台自动发生,然后深入到您想要的依赖项,右键单击,然后说“打开 Javadoc”。请参阅:
http://www .sonatype.com/people/2008/10/browsing-javadoc-for-dependencies-in-eclipse-m2eclipse/
If you run
mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true
from the root of your project, it will download any sources & javadocs on the remote repository to your local repository. If you have m2eclipse, you can set that in the preferences to happen automatically in the background, and then drill down to the dependency you want, right click and then say 'open Javadoc'. See:
http://www.sonatype.com/people/2008/10/browsing-javadoc-for-dependencies-in-eclipse-m2eclipse/
Netbeans 为 Maven 项目提供下载 Javadoc 功能。首先运行它,然后出现一个查看 Javadoc 选项。
Netbeans has a Download Javadoc feature for Maven projects. Run that first, then a View Javadoc option appears.