You are previewing Maven: The Definitive Guide.

Maven: The Definitive Guide

Cover of Maven: The Definitive Guide by Sonatype Company Published by O'Reilly Media, Inc.
O'Reilly logo

Customizing Site Appearance

The default Maven template leaves much to be desired. If you wish to customize your project’s web site beyond simply adding content, navigational elements, and custom logos, Maven offers several mechanisms for customizing your web site that allow successively deeper access to content decoration and web site structure. For small, per-project tweaks, providing a custom site.css is often enough. However, if you want your customizations to be reusable across multiple projects, or if your customizations involve changing the XHTML that Maven generates, you should consider creating your own Maven web site skin.

Customizing the Site CSS

The easiest way to affect the look and feel of your project’s web site is through the project’s site.css. Just like any images or XHTML content you provide for the web site, the site.css file goes in the src/site/resources directory. Maven expects this file to be in the src/site/resources/css subdirectory. With CSS, it is possible to change text styling properties, layout properties, and even add background images and custom bullet graphics. For example, if we decided to make the menu heading stand out a little more, we might try the following style in src/site/resources/css/site.css:

#navcolumn h5 {
  font-size: smaller;
  border: 1px solid #aaaaaa;
  background-color: #bbb;
  margin-top: 7px;
  margin-bottom: 2px;
  padding-top: 2px;
  padding-left: 2px;
  color: #000;

When you regenerate the web site, the menu headers should be framed by a ...

The best content for your career. Discover unlimited learning on demand for around $1/day.