English 中文(简体)
我如何在 Java引用UML? [闭门]
原标题:How can I draw UML in Java docs? [closed]

我们不准许对书籍、工具、软件图书馆以及更多的图书馆征求建议的问题。 你可以ed问这个问题,以便用事实和引言回答。

Closed 5 years ago.

我试图找到一种工具/框架/插图,使我能够在我的javadocs评论中提取UML图表。 我不需要倒置的自动紫外线图像(有效提供途径是UMLph 和其他)。 我想能够制作我自己的习俗图表。 您能建议什么?

问题回答

我尝试了3种方法,在JavaDocs内利用Maven-javadoc-plugin和 do子生成UML Diagrams:

(1) Uml GraphDoc

2)a

3) yworks

我可以说,最好的选择是选择3,因为它是唯一不需要在发展阶段安装东西的人。

Uml GraphDoc和Apiviz(均为专册)在PC中安装图西。

由此而来并混淆了马文-贾瓦图-普鲁宁是一件容易的事,但是由于它们要求单独提出申请,它使尼共(毛主义)一代成为一种比喻,因为如果你想把摩尔的一代作为你们的晚辈生活周期的一部分,那么所有其他开发商都需要安装图西(A”号,我真的希望避免<>)。

无论如何,这一联系采用我所遵循的方法,即使用劳作(真正发挥作用):

正如我的3个组合尝试那样,正如你想要证实以下一点:


1st try : UmlGraphDoc

It requires to install graphviz-2.38 (google it, it s easy to find) Diagrams are quite ugly, but understandable!!

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.2</version>
            <reportSets>
                <reportSet>
                    <id>uml</id>
                    <reports>
                        <report>javadoc</report>
                    </reports>
                    <configuration>
                        <name>uml</name>
                        <destDir>uml</destDir>
                        <quiet>true</quiet>
                        <aggregate>true</aggregate>
                        <show>private</show>
                        <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
                        <docletArtifact>
                            <groupId>org.umlgraph</groupId>
                            <artifactId>umlgraph</artifactId>
                            <version>5.6.6</version>
                        </docletArtifact>
                        <additionalparam>
                            -inferrel -inferdep -quiet -hide java.* -hide org.eclipse.* -collpackages java.util.* -postfixpackage
                            -nodefontsize 9 -nodefontpackagesize 7 -attributes -types -visibility -operations -constructors
                            -enumerations -enumconstants -views
                        </additionalparam>
                        <useStandardDocletOptions>true</useStandardDocletOptions>
                    </configuration>
                </reportSet>
            </reportSets>
        </plugin>

2nd try :Apiviz

It also requires to install graphviz-2.38 (Google it, it s easy to find) Diagrams generated are nicer than first option...

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <name>JavaDocUML</name>
                <destDir>uml</destDir>
                <doclet>org.jboss.apiviz.APIviz</doclet>
                <stylesheetfile>${basedir}/src/main/resources/javadoc/javadoc-stylesheet.css</stylesheetfile>
                <docletArtifact>
                    <groupId>org.jboss.apiviz</groupId>
                    <artifactId>apiviz</artifactId>
                    <version>1.3.2.GA</version>
                </docletArtifact>
                <useStandardDocletOptions>true</useStandardDocletOptions>
                <charset>UTF-8</charset>
                <encoding>UTF-8</encoding>
                <docencoding>UTF-8</docencoding>
                <breakiterator>true</breakiterator>
                <version>true</version>
                <author>true</author>
                <keywords>true</keywords>
                <additionalparam>
                    -sourceclasspath ${project.build.outputDirectory}
                </additionalparam>
            </configuration>
        </plugin>

3th try (ywork) (I recommend this one)

Diagrams are much more understandable and wide more cooler :D It does not requires to install anything on your pc, you just need to download yworks-uml-doclet-3.0_02-jdk1.5 from its website and have it near your pom.xml, and using relative paths you can find it and use it as follows:

<properties>
    <yworks.uml.path>${basedir}....	oolsyworks-uml-doclet-3.0_02-jdk1.5</yworks.uml.path>
</properties>
.
.
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.2</version>
            <configuration>
                <name>JavaDocUML</name>
                <destDir>uml</destDir>
                <!-- Doclet -->
                <doclet>ydoc.doclets.YStandard</doclet>
                <docletPath>${yworks.uml.path}/lib/ydoc.jar:${yworks.uml.path}/resources:${basedir}/target/your.application.jar</docletPath>
                <additionalparam>-umlautogen</additionalparam>
                <useStandardDocletOptions>true</useStandardDocletOptions>
                <!-- bootclasspath required by Sun s JVM -->
                <bootclasspath>${sun.boot.class.path}</bootclasspath>
                <!-- General Javadoc settings -->
                <doctitle>${project.name} (${project.version})</doctitle>
                <show>private</show>
                <!-- Styling -->
                <stylesheetfile>${basedir}/src/main/resources/javadoc/javadoc-stylesheet.css</stylesheetfile>
                <docfilessubdirs>true</docfilessubdirs>
                <!-- Apple s JVM sometimes requires more memory -->
                <additionalJOption>-J-Xmx1024m</additionalJOption>
                <verbose>true</verbose>
            </configuration>
        </plugin>

事实上,你提到的“UMLGraph”也包含“Javadoc”工具的替代材料,该工具将产生UML diagrams,作为 Java思想制作的一部分。 我在此发现这一信息:http://wiki.wsmoak.net/cgi-bin/wiki.pl?UMLGraph”rel=“nofollow” http://wiki.wsmoak.net/cgi-bin/wiki.pl?UMLph





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...