Table of Contents

Configuring reporting in Maven projects


Prerequisites

Maven project is opened in Visual Studio. You can find instructions how to create a Maven project in this section. You can also find an overview of Maven projects in this section.

Actions

Introduction

Regular Maven builds generate build artifacts (e.g. JAR archives). It is often useful to have other kind of information produced or extracted from the project. This can be documentation, code analysis, metrics, etc. This kind of build results is not primarily meant for redistribution, but rather internal usage by the project developers. In Maven terminology it is called reporting.

Maven offers a separate lifecycle and plugin configuration structure for reporting purposes, independently of build plugins. The reporting lifecycle is called site and you can execute it by right-clicking on the main project node and choosing Maven / Site / Generate option. Generate and view option additionally opens generated documentation in Visual Studio. From Maven command line, the corresponding command is mvn site.

You can find more info on reporting in this section of Maven docs.

Viewing configured reporting plugins

Reports in Maven are also generated by plugins. Those plugins however form a separate category from regular build plugins (which are described here). You can view them under the Reporting plugins node in Solution Explorer:

Another difference between reporting and regular plugins is that reporting plugins are not bound to build phases (at least explicitly). Maven just executes them sometime when running the site lifecycle and it is not relevant in which actual phase.

Because of the above difference, reporting plugins do not have executions. Instead, you can configure one or more report sets to be generated by a plugin. Each report set shares common configuration, and can generate one or more reports. A report is a counterpart of a goal in regular plugins. In fact, technically this is the same thing as goal. Also report set is similar to execution element in many aspects. But it does not have phase attribute and can't be bound to any particular build phase.

Adding, removing and configuring plugins

In order to add a plugin to the list, right click on the Reporting plugins node and choose New item. A property editor window will appear, where you can enter basic plugin data: mainly the group, artifact and version. In most cases you will be configuring standard Maven plugins, hence the group id will be default org.apache.maven.plugins and the artifact name can be choosen from the standard plugins list (click the arrow button next to the field to open it). The version parameter can be left empty.

To remove a plugin, right-click on it and choose Remove. You can also edit its basic Properties.

For advanced configuration of a plugin, you will need to write some XML code. First of all, you need to decide whether to configure each of the report sets separately, or supply one configuration for all report sets. For the latter one, right-click on a plugin node and choose Edit configuration node. A XML editor will open in Visual Studio, where you can edit the <configuration> node contents. It is dependent on particular plugin. Each plugin has its own XML format of the configuration.

Note that IntegraStudio does not check correctness of entered configuration, because only particular Maven plugin can do it. In case of wrong configuration, you will get Maven errors during the build.

The configuration specified here will be used for all report sets, unless overridden in particular report set. It is also effective for report sets supplied by Maven by default (when you do not specify any report set by hand).

Adding, removing and configuring report sets

If you want to customize the default reporting, you will need to add one or more report set elements. Each report set collects together the following data, describing what and how to execute:

What

How

Table of Contents


Copyright (C) 2014-2016 SOFT-ERG. All rights reserved.