Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Maven Project Documentation

Maven Project Documentation

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

For example, we created the consumerBanking project in the C:/MVN directory, 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 present):

<

project

...

<

build

<

pluginManagement

<

plugins

<

plugin

<

groupId

org.apache.maven.plugins

groupId

<

artifactId

maven-site-plugin

artifactId

<

version

3.3

version

plugin

<

plugin

<

groupId

org.apache.maven.plugins

groupId

<

artifactId

maven-project-info-reports-plugin

artifactId

<

version

2.7

version

plugin

plugins

pluginManagement

build

...

project

Otherwise, running mvn site the command will produce java.lang.NoClassDefFoundError: org/apache/maven/doxia/siterenderer/DocumentContent the problem of , this is because the maven-site-plugin version is too low, just upgrade to 3.3+.

Open the consumerBanking folder and execute the following mvn command.

C:\MVN\consumerBanking> mvn site

Maven starts generating documentation:

[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 to see the documentation.

Maven uses a documentation processing engine called Doxiato create documentation, it can read source code in multiple formats into a common document model. To write documentation for your project, you can write content in the following common formats that can be transformed by Doxia.

Format name Description Reference
Apt Plain text document format http://maven.apache.org/doxia/references/apt-format.html
Xdoc A document format of Maven 1.x http://jakarta.apache.org/site/jakarta-site2.html
FML Suitable for FAQ documents http://maven.apache.org/doxia/references/fml-format.html
XHTML Extensible HTML document http://en.wikipedia.org/wiki/XHTML