JavaDoc with UML Diagram on Eclipse

1. 준비

  • Eclipse & commented source project
  • GraphViz 설치
    • https://www.graphviz.org/
    • 예: C:\Program Files (x86)\Graphviz2.38
  • UmlGraph 설치
    • https://www.spinellis.gr/umlgraph/index.html
    • Jar 다운로드 & 이동/복사
    • 예: C:\Workspace.eclipse\Project\lib\UmlGraph-5.7_2.32-SNAPSHOT.jar

2. Using Eclipse Generate Javadoc UI

  • Use standard doclet 선택 <- 가장 중요
  • Extra Javadoc options로 다음 내용 추가
-doclet org.umlgraph.doclet.UmlGraphDoc
-docletpath D:\Workspace.eclipse\Test\lib\UmlGraph-5.7_2.32-SNAPSHOT.jar
-dotexecutable "C:\Program Files (x86)\Graphviz2.38\bin\dot.exe"
-attributes
-operations
-qualify
-types
-visibility
  • Finish로 Javadoc 생성
  • (참고) Ant용 스크립트(.xml)를 저장하면 다음과 같이 나옴
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="javadoc">
    <target name="javadoc">
        <javadoc access="private" additionalparam=" -doclet org.umlgraph.doclet.UmlGraphDoc&#13;&#10;-docletpath D:\Workspace.eclipse\Test\lib\UmlGraph-5.7_2.32-SNAPSHOT.jar&#13;&#10;-dotexecutable &quot;C:\Program Files (x86)\Graphviz2.38\bin\dot.exe&quot;&#13;&#10;-attributes&#13;&#10;-operations&#13;&#10;-qualify&#13;&#10;-types&#13;&#10;-visibility" author="true" classpath="." destdir="doc" doctitle="Document Title" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="aaa.bbb.ccc.ddd" source="1.8" sourcepath="src" splitindex="true" use="true" version="true"/>
    </target>
</project>

3. Using Ant

  • Eclipse 프로젝트 폴더 아래 Ant용 build.xml 생성
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="javadoc">
  <target name="javadoc" description="Generate javadoc with UML Diagram">
    <property name="src.dir"  value="src"/>
    <property name="javadoc.dir"  value="doc-uml"/>
    <property name="dot.path"  location="C:\Program Files (x86)\Graphviz2.38\bin"/>
    <mkdir dir="${javadoc.dir}"/>
    <javadoc access="private" doctitle="Test" author="true" classpath="." packagenames="kr.re.etri.heat.jms" source="1.8" sourcepath="${src.dir}" destdir="${javadoc.dir}" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" splitindex="true" use="true" version="true">
      <doclet name="org.umlgraph.doclet.UmlGraphDoc" path="lib/UmlGraph-5.7_2.32-SNAPSHOT.jar">
        <param name="-attributes" />
        <param name="-operations" />
        <param name="-qualify" />
        <param name="-types" />
        <param name="-visibility" />
        <param name="-dotexecutable" value="${dot.path}/dot.exe" />
      </doclet>
    </javadoc>
  </target>
</project>

4. [Note]

  • UML Diagram들의 형식 변경은 UmlGraphDoc으로 넘기는 옵션 parameter들로 조정

    댓글

    이 블로그의 인기 게시물

    [DevTip] Windows에서 tail 쓰기...

    환경개선부담금

    Electropermanent Magnets: Programmable Magnets with Zero Static Power Consumption Enable Smallest Modular Robots Yet