November 27, 2009

Maven Site Example

« Java Monitoring Project | Main | Python XML Processing - libxml2 »

The Maven Site Plugin enables you to create automatically software documentation. Particularly it represents a standard way of software report generation. Additionally you have the possibility of creation your own specialized report plugins. The following example describes how you can use the plugin in your Maven project.

  (1) Create your project
    mvn archetype:create -DgroupId=org.developers.blog.site -DartifactId=test
  (2) Generate the standard site
    mvn site:site
  (3) Look at your browser -> target/site/index.html

For customizing your software documentation you have to create a directory at src/site. After that you have to add the following or changed site.xml file in this directory.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
    <bannerLeft>
        <name>AOP based Monitoring</name>
        <src>images/logo.png</src>
        <href>http://java-monitor.sourceforge.net/</href>
    </bannerLeft>
    <bannerRight>
        <src>images/title.png</src>
    </bannerRight>
    <body>
        <links>
            <item name="Developers Blog" href="http://developers-blog.org" />
        </links>
        <menu name="Overview">
            <item name="Description and Usage" href="index.html"/>
            <!--item name="Goals" href="plugin-info.html"/>
            <item name="Usage" href="usage.html"/>
            <item name="FAQ" href="faq.html"/-->
        </menu>
        <menu ref="reports"/>
    </body>

</project>

After that you have to define your customized start page for example with the help of the xdoc format. But first you must create the directory src/site/xdoc/. Thereafter you create your customized xdoc content at the index.xml file in this directory.

<?xml version="1.0" encoding="UTF-8"?>
<document>
    <properties>
        <author>Rafael Sobek</author>
        <title>Simple Monitoring Plugin</title>
    </properties>
    <meta name="keyword" content="monitoring, java"/>
    <body>
        <section name="Idea and Concept">
            <p>
               An easy way to realize monitoring in existing or new Java based software projects.
               This monitoring solution reduces the complexity of software monitoring to a minimum.
               Developers have only to configure the Simple Monitoring Plugin in
               Maven project file (pom.xml). It automatically analyzes the control flow
               respectively data flow of your software logic and remembers the method calls and
               exceptions as measurement values.
            </p>
            <p>The plugin configuration provides the following opportunities:</p>
            <ul>
                <li>definition of methods and classes, that should be tracked</li>
                <li>choose if monitoring data will be saved local or at a central monitoring database</li>
                <li>clear monitoring data</li>
                <li>additional meta information about developer and department</li>
            </ul>
        </section>
    </body>
</document>

Now you can see your customized generated page at target/site/index.html on mvn site:site call.

Regards
Rafael Sobek

Technorati Tags:

Posted by rafael.sobek at 6:33 PM in Maven

 

[Trackback URL for this entry]

Your comment:

(not displayed)
 
 
 

Live Comment Preview:

 
« November »
SunMonTueWedThuFriSat
1234567
891011121314
15161718192021
22232425262728
2930