java Javadoc 插入 UML 图

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1411172/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 16:27:39  来源:igfitidea点击:

Javadoc Inserting UML Diagrams

javajavadocclass-diagram

提问by Mo .

Is there a way to embed images into my JavaDoc? Basically i want to include some UML diagrams explaining the hierarchy of my classes in some of the documentation.

有没有办法将图像嵌入到我的 JavaDoc 中?基本上我想在一些文档中包含一些 UML 图来解释我的类的层次结构。

Thanks!

谢谢!

回答by Adamski

Check out this sectionof the Javadoc documentation, which explains how to embed images in your Javadoc.

查看Javadoc 文档的这一部分,它解释了如何在 Javadoc 中嵌入图像。

Also, here is an articledescribing how to reverse engineer UML diagrams and embed them in your Javadoc using UMLGraph.

此外,这里有一篇文章描述了如何使用UMLGraph对 UML 图进行逆向工程并将它们嵌入到您的 Javadoc 中。

回答by laalto

Yes.

是的。

The documentationexplains how to embed arbitrary images to javadoc documentation.

该文档解释了如何将任意图像嵌入到 javadoc 文档中。

If you want to generate UML class diagrams from your Java source, have a look at the UMLGraph doclet.

如果您想从 Java 源代码生成 UML 类图,请查看UMLGraph doclet

回答by Ondra ?i?ka

This articleshows how to use UMLGraph with Maven Javadoc plugin.

本文展示了如何将 UMLGraph 与 Maven Javadoc 插件一起使用。

In short:

简而言之:

  1. Install GraphViz.

    Ubuntu: apt-get install graphviz4.
    Windows: download.

  2. Update pom.xml.

        <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <aggregate>true</aggregate>
                <show>private</show>
                <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
                <docletArtifact>
                    <groupId>org.umlgraph</groupId>
                    <artifactId>doclet</artifactId>
                    <version>5.1</version>
                </docletArtifact>
                <additionalparam>
                    -inferrel -attributes -types -visibility -inferdep -quiet -hide java.* -collpackages java.util.* -qualify -postfixpackage
                    -nodefontsize 9
                    -nodefontpackagesize 7
                </additionalparam>
            </configuration>
        </plugin>
    
  3. Run mvn javadoc:javadoc.

  1. 安装 GraphViz。

    乌班图:apt-get install graphviz4
    Windows:下载.

  2. 更新 pom.xml。

        <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <aggregate>true</aggregate>
                <show>private</show>
                <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
                <docletArtifact>
                    <groupId>org.umlgraph</groupId>
                    <artifactId>doclet</artifactId>
                    <version>5.1</version>
                </docletArtifact>
                <additionalparam>
                    -inferrel -attributes -types -visibility -inferdep -quiet -hide java.* -collpackages java.util.* -qualify -postfixpackage
                    -nodefontsize 9
                    -nodefontpackagesize 7
                </additionalparam>
            </configuration>
        </plugin>
    
  3. 运行mvn javadoc:javadoc

回答by Sileria

Simple Answer:

简单回答:

/**
 * This class does some stuff (see diagram).
 * <img src="relative/path/to/image.png" />
 * 
 */
 public class SomeClass{
 }

回答by elhoim

ApiVizis a nice doclet too.

ApiViz也是一个不错的 doclet。

回答by yegor256

yDocis an option

yDoc是一个选项

回答by Vincent Ramdhanie

This articleexplains how it can be done by placing your images in a folder accessible to the javadoc tool.

文章解释了如何可以通过把你的图片到javadoc工具访问的文件夹中完成。