English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Maven Project Documentation

In this chapter, we mainly learn how to create Maven project documents.

For example, on C:/In the MVN directory, the consumerBanking project was created. Maven uses the following command to quickly create a java project:

mvn archetype:generate -DgroupId=com.companyname.bank -DartifactId=consumerBanking -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Modify pom.xml and add the following configuration (if not already present):

<project>
  ...
<build>
<pluginManagement>
    <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</<artifactId>maven
          <version>3.3</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</<artifactId>maven
          <version>2.7</version>
        </plugin>
    </plugins>
    </pluginManagement>
</build>
 ...
</project>

Otherwise, an error will occur when running the mvn site command java.lang.NoClassDefFoundError: org/apache/maven/doxia/siterenderer/DocumentContent , This is due to the issue with maven-site-plugin version is too low, upgrade to 3.3+ That's it.

Open the consumerBanking folder and execute the following mvn command.

C:\MVN\consumerBanking> mvn site

Maven starts generating documents:

[INFO] Scanning for projects...
[INFO] -------------------------------------------------------------------
[INFO] Building consumerBanking
[INFO] task-segment: [site]
[INFO] -------------------------------------------------------------------
[INFO] [site:site {execution: default-site}]
[INFO] artifact org.apache.maven.skins:maven-default-skin: 
checking for updates from central
[INFO] Generating "About" report.
[INFO] Generating "Issue Tracking" report.
[INFO] Generating "Project Team" report.
[INFO] Generating "Dependencies" report.
[INFO] Generating "Continuous Integration" report.
[INFO] Generating "Source Repository" report.
[INFO] Generating "Project License" report.
[INFO] Generating "Mailing Lists" report.
[INFO] Generating "Plugin Management" report.
[INFO] Generating "Project Summary" report.
[INFO] -------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] -------------------------------------------------------------------
[INFO] Total time: 16 seconds
[INFO] Finished at: Wed Jul 11 18:11:18 IST 2012
[INFO] Final Memory: 23M/148M
[INFO] -------------------------------------------------------------------

Open C:\MVN\consumerBanking\target\site Folder. Click index.html You Can See the Document.

Maven Uses a Named DoxiaDocument Processing Engine to Create Documents, It Can Read Source Codes of Various Formats into a Universal Document Model. To Write Documentation for Your Project, You Can Write the Content in the Following Common Formats, Which Can Be Converted by Doxia.

Format NameDescriptionReference
AptPlain Text Document Formathttp://maven.apache.org/doxia/references/apt-format.html
XdocMaven 1A Document Format of .xhttp://jakarta.apache.org/site/jakarta-site2.html
FMLFAQ Documentation Applieshttp://maven.apache.org/doxia/references/fml-format.html
XHTMLExtensible HTML Documenthttp://en.wikipedia.org/wiki/XHTML