Giter VIP home page Giter VIP logo

uml-java-doclet's Introduction

Overview

Add UML diagrams (using PlantUML) to Javadocs. Extends the standard Java doclet.

Background

The inspiration for this project is better communication between the developers on my team. We want to follow the principles of DDD and Model-Driven Design (https://www.amazon.ca/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215/ref=sr_1_1?s=books&ie=UTF8&qid=1475876769&sr=1-1&keywords=domain+driven+design) and automatically generating class diagrams is a key part of that approach.

Diagrams

Generates three types of diagrams:

  • Overview: Shows all classes within all packages. Click on a class to get to the Javadoc for that class. Click on a package to get to the Javadoc for that package.
  • Package: Shows all of the classes within a package, and the relationships between them. Does not show relationships with classes outside the package.
  • Class: Shows all of the relationships with other classes. If the other class is in the same package, it is shown in yellow (default color). If in another package within the set of packages, it is shown in white. If the other class is outside any of the packages, it is shown in grey.

The relationships with other classes are determined by what the Javadoc API provides, which is from the attribute and method declarations for a class. Any usages that are buried within code will not be shown. If I think a relationship is important enough to be shown, I will make it explicit (e.g. add an attribute to the other class).

Layouts can appear strange. This is due to the use of GraphViz. Good enough for my purposes, although there are other options that are being explored (http://plantuml.sourceforge.net/qa/?qa=4842/graphviz-is-not-good-enough).

Dependencies

  • GraphViz (as required by PlantUML).
  • Java 8 (easy enough to backport to earlier versions).

Building

Build using Maven:

mvn clean install

To see an example of the updated Javadocs, use the Javadoc target:

mvn javadoc:javadoc

Javadoc output is in target/site/apidocs.

Installing

To generate UML diagrams for your own project, add the following to your pom.xml. You will need to build the project from scratch in your local environment; the distribution has not yet been uploaded to Maven Central:

<build>
    <plugins>
        <!-- Generate UML diagrams in javadoc using doclet: mvn javadoc:javadoc -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.4</version>
            <configuration>
                <doclet>info.leadinglight.umljavadoclet.UmlJavaDoclet</doclet>
                <docletArtifact>
                    <groupId>info.leadinglight</groupId>
                    <artifactId>uml-java-doclet</artifactId>
                    <version>1.0-SNAPSHOT</version>
                </docletArtifact>
                <!-- -linetype polyline / spline / ortho (default) -->
                <!-- -dependencies public (default) / protected / package / private -->
                <additionalparam></additionalparam>
                <useStandardDocletOptions>true</useStandardDocletOptions>
            </configuration>
        </plugin>
    </plugins>
</build>

Acknowlegments

Many thanks to the folks at PlantUML (https://github.com/plantuml/plantuml) for their fantastic support.

License

Copyright 2016 Gerald Boersma

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

uml-java-doclet's People

Contributors

gboersma avatar hderuiter avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.