Maven - SPLessons

Maven Documents

Chapter 14

SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

Maven Documents

Maven Documents

shape Introduction

One of the best features of Maven is to create Documents that can save the project’s code. Maven Document chapter explains about the Maven javadoc plug-in and Document Process Engine.

shape Description

Maven uses maven-javadoc plug-in, which in-turn uses the javadoce.exe command of bin directory to create the documents. After the completion of project deployment using mvn install command, Maven Documents will be generated. Configuration of javadoc plug-in can be done in pom.xml as shown in the below example.

shape Examples

Add the below code after the dependency tags in Pom file and open the path D:\MavenProject\JavaSamples\ in command prompt and type mvn install command.

<build>
   <plugins>
	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-javadoc-plugin</artifactId>
		<executions>
			<execution>
				<id>attach-javadocs</id>
				<goals>
					<goal>jar</goal>
				</goals>
			</execution>
		</executions>
	</plugin>
   </plugins>
</build>

The output appears as follows.

Generated documents can be found in apidocs in target folder of JavaSamples project as follows.

shape More Info

Maven Documents can be created using processing engine called Doxia. It can take-up different formats into document model. Following formats can be used to write the content for the project.

Summary

shape Key Points

  • javadoc plug-in generates Maven Documents.
  • After entering the mvn install command, the documents are generated in apidocs folder.
  • Doxia processing engine helps Maven in creating the Documents.