Tuesday, March 27, 2012

NetBeans 7.0 and 7.1 UML plugin

If you are using NetBeans 7.0 or 7.1, you probably can't find your UML plugin any more in the default repository.

From what I can read on the net, the team is working on the plugin rewriting it, and this will take a while.


Semi-broken solution

There is another way to install it, but beware, the plugin will be semi-broken, so jump down to another solution if you like to generate a pretty UML diagram from your code:
  1. by the menu navigate to Tools -> Plugins;
  2. select the "Settings" tab;
  3. click the "Add" button;
  4. as URL copy the following into the textbox:
    http://dlc.sun.com.edgesuite.net/netbeans/updates/6.9/uc/m1/dev/catalog.xml
Now on the tab "Available Plugins" there should be UML in category UML.

The problems are:
  • "reverse engineering" command seem to work but you can't open the files;
  • you can write a class diagram and work on it, but when you open your project next time you will unable to open the diagram again.
So all you can do is work on a temporary diagram, if you need only it.


Another solution

You can use yWorks UML Doclet community edition.
This solution will only let you generate a pretty UML diagram from your code.

  1. Download the library from here;
  2. right click on your java project in project explorer within NetBeans;
  3. click on "Properties";
  4. select  Build => Documenting;
  5. on "Additional Javadoc Options" textbox paste the following (beware, I'm under windows):
    -docletpath "<yworks-uml-doclet-path>\lib\ydoc.jar" -resourcepath "<yworks-uml-doclet-path>\resources" -doclet ydoc.doclets.YStandard -umlautogen

    Where <yworks-uml-doclet-path> is the path of the yworks-uml-doclet folder.
    In my case <yid> is:
    E:\Users\retek\dev\lib\java\yworks-uml-doclet\yworks-uml-doclet-3.0_01-jdk1.5
  6. click "OK";
  7. right click on your java project in project explorer within NetBeans;
  8. click Generate Javadoc;
Now, within your Javadoc you will have a very nice UML driagram for your classes.

Thanks to Matthew W. Johnson for this solution.