在不同项目之间交叉链接 java doc

发布于 2024-12-20 08:18:24 字数 1960 浏览 4 评论 0原文

我无法让 javadoc 引用另一个项目的 API。

项目之间有严格的雇佣关系(“应用程序”项目引用的“公共”项目)。 这两个项目都构建得很好,因此不存在实际不存在的类和包的问题。

我的理解是,javadoc 没有像 Java 那样的构建路径,而是使用其他 javadoc 网站的链接。就能够生成 HTML 交叉引用而言,有一些非常合乎逻辑的原因。

我的尝试如下:

  1. 我已经为公共项目构建了 javadoc
  2. ,我将其放在 Intranet 上的 Web 服务器上,
  3. 我将 API(在我的 Intranet 上)的链接添加到了应用程序项目中的 javadoc ant 任务。
  4. 我尝试构建应用程序项目

Javadoc 仍然会输出以下形式的错误消息:

[javadoc] C:\Users\couling\workspace\app\src\com\blahblah\app\AppMain.java:14: package com.blahblah.common.foo does not exist
[javadoc] import com.blahblah.common.foo.Bar
[javadoc]                               ^

生成的 javadoc 项目之间没有交叉链接。

这两个项目的 ant 任务如下:

Common:

<javadoc 
         access="protected" 
         author="true" 
         classpath="." 
         destdir="out/doc/docs" 
         nodeprecated="false"
         nodeprecatedlist="false" 
         noindex="false" 
         nonavbar="false" 
         notree="false"
         packagenames="*"
         source="1.6" 
         sourcepath="src" 
         splitindex="true" 
         use="true" 
         version="true">
             <link href="http://download.oracle.com/javase/6/docs/api/" />
</javadoc>

App:

<javadoc 
         access="protected" 
         author="true" 
         classpath="." 
         destdir="out/doc/docs" 
         nodeprecated="false"
         nodeprecatedlist="false" 
         noindex="false" 
         nonavbar="false" 
         notree="false"
         packagenames="com.blahblah.app.*"
         source="1.6" 
         sourcepath="src" 
         splitindex="true" 
         use="true" 
         version="true">
             <link href="http://intranet.blahblah.com/api/common/docs/" />
             <link href="http://download.oracle.com/javase/6/docs/api/" />
</javadoc>

对于我需要做什么才能让 app 引用 common 有什么想法吗?

I'm having trouble getting javadoc to reference another project's API.

There's a strict hirearchy between the projects (a "common" project referenced by an "app" project).
Both projects build just fine, so there's no issue with classes and packages not actually existing.

My understanding is that javadoc doesn't have a sort of buildpath in the same way that Java does, but uses links to other javadoc websites instead. There's some pretty logical reasons for this in terms of being able to generate HTML cross references.

My attempt to make this goes as follows:

  1. I've built the javadoc for the common project
  2. I threw that on a webserver on my intranet
  3. I added a link to the api (on my intranet) to the javadoc ant task in the app project.
  4. I attempted to build the app project

Javadoc still spits out error messages of the form:

[javadoc] C:\Users\couling\workspace\app\src\com\blahblah\app\AppMain.java:14: package com.blahblah.common.foo does not exist
[javadoc] import com.blahblah.common.foo.Bar
[javadoc]                               ^

The resulting javadoc has no cross links between the projects.

The ant tasks for the two projects are as follows:

Common:

<javadoc 
         access="protected" 
         author="true" 
         classpath="." 
         destdir="out/doc/docs" 
         nodeprecated="false"
         nodeprecatedlist="false" 
         noindex="false" 
         nonavbar="false" 
         notree="false"
         packagenames="*"
         source="1.6" 
         sourcepath="src" 
         splitindex="true" 
         use="true" 
         version="true">
             <link href="http://download.oracle.com/javase/6/docs/api/" />
</javadoc>

App:

<javadoc 
         access="protected" 
         author="true" 
         classpath="." 
         destdir="out/doc/docs" 
         nodeprecated="false"
         nodeprecatedlist="false" 
         noindex="false" 
         nonavbar="false" 
         notree="false"
         packagenames="com.blahblah.app.*"
         source="1.6" 
         sourcepath="src" 
         splitindex="true" 
         use="true" 
         version="true">
             <link href="http://intranet.blahblah.com/api/common/docs/" />
             <link href="http://download.oracle.com/javase/6/docs/api/" />
</javadoc>

Any thoughts on what I need to do to get app to reference common?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如梦初醒的夏天 2024-12-27 08:18:24

元素(或命令行 javadoc 的 -link 选项)仅有助于生成链接 - 但 Javadoc 在较早的点停止,它不能如果您的应用程序类引用了未知(常见)类,则它们确实可以与您的应用程序类一起使用。

在这方面,Javadoc 的工作方式与 Javac 类似 - 您必须以某种方式将其指向要使用的类,即它们必须位于类路径中。您可以使用 元素指向 jar 文件或类目录,或使用 元素指向源(如果你需要继承他们的一些评论)。

链接到标准 API 不需要这样做,因为它已经包含在编译器中。

请注意,以这种方式链接需要 Javadoc 从此 URL 下载package-list - 您可以改为指向包含此 package-list 文件的本地目录。

The <link> element (or the -link option for command line javadoc) only help with generating the links - but Javadoc stops at an earlier point, it can't really work with your app classes if they reference unknown (common) classes.

In this respect, Javadoc works just like Javac - you must somehow point it to the classes to be used, i.e. they must be in the class path. You can use a <classpath> element to point to the jar file or class directory, or a <sourcepath> element, to point to the sources (do this if you need to inherit some comments from them).

This is not needed for linking to the standard API, since it is already included in the compiler.

Note that linking in this way requires Javadoc to download the package-list from this URL - you can instead point to a local directory which contains this package-list file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文