简体   繁体   中英

Is there any way to automate Javadoc attachment for non-JRE bundles in Eclipse?

First, this is not about the Java SE Javadocs. That's working fine.

We have a large Java-based platform, with about 20 API bundles. For people who use our platform, we'd like tooltips and other such built-in doc support to work just as it already does for the Java APIs.

Our Javadocs are at a URL available to those who use our platform, and work properly when manually attached to a referenced bundle using the usual approach.

Eclipse doesn't seem to persist the Javadoc attachment - that is, when you attach Javadocs to a bundle, it works, but when you restart Eclipse, that attachment is lost.

With at least 20 API bundles, and a typical workspace using our platform having at least 10 or more projects, having to manually attach Javadocs to each referenced bundle for each project is not workable (could be 200 manual attachments, eg) each time Eclipse is restarted.

Is there any way for this to be automated? I'm not above some kind of scripting solution, even if it had to be run each time Eclipse was started, though clearly, it would be better if it just "worked", the way it does for the Java APIs. (For that matter, I'd love this to also work for various things like Apache Commons, Bouncy Castle, Android, etc.).

Thanks...

This problem can be solved by providing a bundle containing Javadoc with your Target Platform (no source code included). Here are the steps to achieve this:

  1. Create plug-in containing full Javadoc of your API
  2. Define extension via org.eclipse.pde.core.javadoc extension point in this plug-in like this:
<extension point="org.eclipse.pde.core.javadoc">
    <javadoc path="javadoc"> <!-- relative path to the API javadoc directory (can also be a URL) -->
        <plugin id="com.acme.core"/>
        <plugin id="com.acme.ui"/>
        <!-- list plug-ins which have been documented in the docs -->
    </javadoc>
</extension>
  1. Export this plug-in and add it to the Target Platform

In case your Javadoc is already available online via URL, you can just create the plug-in defining an extension and set a URL as a path of the Javadoc element:

<javadoc path="https://acme.com/apidocs">

Eclipse IDE will automatically resolve Javadoc location through the PDE extension for your bundles.

The Eclipse way is to have source bundles/plug-ins (with the MANIFEST.MF header Eclipse-SourceBundle: ... ) . As far as I know, there is nothing like this for Javadoc.

As a workaround , you could use source bundles without internal code , with public APIs only. If the target platform contains source bundles, the existing Javadoc and source code provided by these source bundles are automatically shown in Eclipse.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM