Customizing Site Look and Feel

Your weather application is complete, but the Maven-generated site has the same look and feel as every other Maven project. Change the look and feel.

How do I do that?

Customize the behavior of the XDoc plug-in. Take a look at the following properties from project.properties:

maven.xdoc.date = right
maven.xdoc.date.format = MM/dd/yyyy
maven.xdoc.crumb.separator = >
maven.xdoc.developmentProcessUrl = http://www.slashdot.org
maven.xdoc.poweredBy.title = Powered by the Mighty Maven
maven.xdoc.theme.url=./style/custom.css

These properties set the location and format of the site date, the breadcrumb separator, the development process URL, and the "Powered by" title. Run maven site, and you will see how these properties made subtle changes to the generated site. Changing the development process URL is important if your organization maintains a page dedicated to your development process. If you leave this property unchanged it will point to a page on the maven.apache.org web site.

What just happened?

To customize the look and feel, you will need to alter the CSS used by Maven. To get a sense of the styles used in the Maven theme, take a look at the target/docs/style directory of your generated Maven site. Here you will find files named maven-base.css, maven-classic.css, and maven-theme.css. You will need to override these styles to customize the look and feel of Maven. The file is stored in xdocs/style/custom.css, and is specified by the maven.xdoc.theme.url ...

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.