Generating a Multiproject Web Site

Now that you know how to build all your projects, let's build a master web site containing content from all the different subprojects' web sites. Indeed, as you know, each Maven project can generate its web site by executing the Site plug-in. However, in the case of your master project, calling maven site would not aggregate the web sites from the different subprojects it is made of.

How do I do that?

Fortunately, the Multiproject plug-in is here to help once again. It has a goal called multiproject:site which you can use to generate this master web site. Let's run it by typing maven multiproject:site. The generated site is located in target/docs/index.html. As you can see in Figure 3-8, one of the generated pages is the project overview page, which lists the web sites for all the subprojects.

Generated multiproject web site showing the overview page

Figure 3-8. Generated multiproject web site showing the overview page

You can decide not to have an overview page if you wish, or you can customize it by playing with the following properties (the default values are shown here):

maven.multiproject.overviewPage.create=true
maven.multiproject.overviewPage.title=Overview of projects
maven.multiproject.overviewPage.link=projects-overview
maven.multiproject.overviewPage.linkTitle=Overview of project
maven.multiproject.overviewPage.text=

Note that the value of maven.multiproject.overviewPage.text would be displayed ...

Get Maven: A Developer's Notebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.