As I discussed in the Maven Lifecycle page, you can use mvn site (maven site command) to generate project documentation. The official Apache maven site is also created using the same tool. Will use the same project from Spark app, and create documentation of it.

To create project documentation, follow the below steps.

Step 1:
Add the latest version of maven-site-plugin and maven-project-info-reports-plugin in the pom.xml.


Refer to this article to understand why you need to upgrade the above plugins.

Step 2:
Now run the command below to generate static documentation of your code, this is basically CSS and HTML docs:

mvn site
mvn site index.html

Step 3:
To view the generated doc in the browser run the below command and then open http://localhost:8080.

mvn site:run

To stop the jetty running on localhost:8080, press Ctrl + C.

More information about the mvn-site-plugin can be found on the official site.

By |Last Updated: August 3rd, 2019|Categories: Java™, Maven|

Table of Contents