Maven is a project comprehension tool at heart. Its general goal is to wrap existing project sources and make sense of them by providing different views. In this chapter you will learn about several Maven plug-ins that help provide visibility for project stakeholders and users. You'll play with plug-ins providing four types of visibility:
It is useful to provide visibility on project content, such as mailing lists used, the development team, the Source Control Management (SCM) repository used, the project dependencies, and more.
The XDoc plug-in automatically generates project information by parsing the Project
Object Model (POM). Let's take the qotd/core
subproject. Typing maven
xdoc
(also called if you run maven
site
) generates Figure 4-1, where you can see
the following four reports:
- Mailing Lists
The different mailing lists used by the project. They are defined in the POM using the
mailingLists
tag (see "Telling Maven About Your Team" in Section 1.1).- Project Team
The members of the teams, and their roles. They are defined in the POM using the
developers
andcontributors
tags (see "Telling Maven About Your Team" in Section 1.1).- Dependencies
A list of external dependencies used by the project. They are defined in the POM using the
dependencies
tag (see "Adding a Dependency" in Section 1.1).- Issue Tracking
A link to the issue tracker used by the project. It is defined in the POM using the
issueTrackingUrl
tag.
Figure 4-2 shows the
Dependencies report for qotd/core
.
It provides interesting information for people who want to use your
project, as they can see at a glance what dependencies they'll be
using.
Note that the URL field is computed from the optional url
tag that you can define in a dependency
tag:
<dependency>
<groupId>rome</groupId>
<artifactId>rome</artifactId>
<version>0.5</version>
<url>http://rome.dev.java.net/</url>
</dependency>
It is also useful to ask Maven to generate HTML pages for the
source code (main sources and test sources). You'll see in the rest of
this chapter that several other reports are automatically linked to
these HTML pages. You generate these reports by adding the JXR
plug-in's report to the reports
section of your project's POM. Add it to qotd/core/project.xml:
<reports> <report>maven-jxr-plugin</report> </reports>
...other project information reports?
You could use the License and Linkcheck plug-ins. The former displays
your license (specified using the maven.license.licenseFile
property, which
defaults to ${basedir}/LICENSE.txt) and the latter
generates a report listing all the broken links in the web site
generated by the execution of maven
site
. You add them to your POM by adding the maven-license-plugin
and maven-linkcheck-plugin
report elements in
the reports
section of your
POM.
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.