Api diagrams from source

ApiViz ia another magical tool which can be helpful in learning about the code

Lets see how it works

Download GraphViz

http://www.graphviz.org/Download..php

Set the environment variable

GRAPHVIZ_HOME=C:\Program Files\Graphviz 2.28\bin

ApiViz

http://code.google.com/p/apiviz/#Prerequisites

We can use maven to use it quickly

 

Edit maven pom.xml

 

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9</version>

<configuration>
         <doclet>org.jboss.apiviz.APIviz</doclet>
         <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>
    </plugins>
</build>

 

Lets start magic

 

mvn compile javadoc:javadoc

How to learn about internal details of Open source projects

Open source is good place to learn , but many times we see that documentation is poor.

Mailing lists are great place to learn always but source code is one thing which speaks for itself.

I try to

Draw UML digrams

Draw API diagrams

Some of the free tools which i use i wanted to share

 

Want to read how to use yworks?

See it here

http://jugnu-life.blogspot.com.au/2013/02/generate-uml-diagrams-for-java-from.html

I found building javadocs for project using yworks uml plugin makes it easy to understand how things are flowing.

 

Read about using Apiviz here

 http://jugnu-life.blogspot.com.au/2013/02/api-diagrams-from-source.html

So after downloading source this is the first thing i do to make javadocs again to digg into the code

Want to have more fun ?

Read here

http://code.google.com/p/apiviz/#Sample

http://www.umlgraph.org/download.html

 

What are your ideas to learn in open source ?

Generate UML diagrams for Java from source

ywroks has very good docklet for generating automated UML diagrams from java source code

Here are steps to use it.

I am using maven based system , although you can use ant also. Read the documentation on yworks website. On linux based system you need x server running for uml generation.

Step 1

Download docklet jars

http://www.yworks.com/en/downloads.html#yDoc

Extract it to some location say

D:\Development\yworks-uml-doclet-3.0_01-jdk1.5

 

Step 2

Tell maven you want to use this docklet

Add following to your pom.xml

Add property for path

Add build details for javadoc

<project>…..

<properties>
        <yworks.uml.path>D:\Development\yworks-uml-doclet-3.0_01-jdk1.5</yworks.uml.path>
</properties>

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <!-- Doclet -->
                    <doclet>ydoc.doclets.YStandard</doclet>
                    <docletPath>${yworks.uml.path}/lib/ydoc.jar:${yworks.uml.path}/lib/ydoc.jar:${yworks.uml.path}/resources:${yworks.uml.path}/lib</docletPath>
                    <additionalparam>-umlautogen</additionalparam>
                    <!-- bootclasspath required by Sun's JVM -->
                    <bootclasspath>${sun.boot.class.path}</bootclasspath>
                    <!-- General Javadoc settings -->
                    <doctitle>${project.name} (${project.version})</doctitle>
                    <show>private</show>

                    <docfilessubdirs>true</docfilessubdirs>
                    <!-- Apple's JVM sometimes requires more memory -->
                    <additionalJOption>-J-Xmx1024m</additionalJOption>
                    <verbose>true</verbose>
                </configuration>
            </plugin>
        </plugins>
    </build>

 

</project>

 

Step 3

Let the magic began

 

mvn:package javadoc:aggregate

or just

mvn javadoc:javadoc

 

Open the javadocs at

/target/site/apidocs/index.html

You can see magical pictures there :)

 

Credit : http://blog.keyboardplaying.org/2012/05/29/javadoc-uml-diagrams-maven/

 

Tip 1: If you want to generate uml for only specific packages use following additional configuration above

<sourcepath>${basedir}/src/main/java/com/MypakagePath</sourcepath>

 


Want to have more fun ?


Read here


http://code.google.com/p/apiviz/#Sample


http://www.umlgraph.org/download.html

Code Auto complete for Maven Eclipse projects

If you want source code and javadocs also downloaded for projects while you are working.

Then choose

I have Eclipse M2E plugin

Windows > Preferences > Maven

Choose

Download Artifact Javadocs

Download Artifacts sources

Related discussions

http://stackoverflow.com/questions/310720/get-source-jar-files-attached-to-eclipse-for-maven-managed-dependencies

http://stackoverflow.com/questions/2059431/get-source-jars-from-maven-repository

Add external repository in Project

I wanted to work against Apache snapshots instead of default repo

So here is what i did

In project pom.xml add the following settings

 

<project>….

<repositories>
        <repository>
            <id>apache.snapshot</id>
            <url>https://repository.apache.org/content/repositories/snapshots//</url>
        </repository>
    </repositories>

 

</project>

Now you can use this inside your project

 

Something like

 

<dependency>
            <groupId>org.apache.mahout</groupId>
            <artifactId>mahout-core</artifactId>
            <version>0.8-SNAPSHOT </version>
        </dependency>

Change Maven local repository path

Open Maven

conf/settings.xml

The path is specified in

Default path is : ~/.m2/repository

You can change it something like below in Windows based systems

<localRepository>K:/MavenRepository/repository</localRepository>

http://www.mkyong.com/maven/where-is-maven-local-repository/