Maven plugin - Overview

This Maven plugin allows to execute Pattern Tests and generate an HTML report of the result.

The Maven plugin is still not ported to Maven 2 and missing in this version. This document still describes the plugin of Maven 1 (it is here to avoid to get lost).


Download it and copy the jar directly into your MAVEN_HOME/plugins directory. That's all.

Using it

First, you should check the Sample application which demonstrates how to use it.

Here are the steps to use it:

  • Create a src/test-aspect directory and put your own Pattern Tests here. This is also where you write Aspects that extends the abstract ones provided by the PatternTesting framework. Note that you can change this location by creating a maven.patterntesting.src property in your
  • Type maven patterntesting. That will produce a raw XML file containing the pattern test violations.
  • Type maven site to generate the HTML report.

That's all really! Simple, no?

PatternTesting Goals

General Settings

Goal Description
patterntesting This is the default goal of the plugin and simply attains the goal patterntesting:generate.
patterntesting:generate Compile and Run pattern tests, generate XML reports if using XMLFormatter.
patterntesting:runtime-test Compile pattern tests, run pattern tests with test suite, and generate XML reports.

PatternTesting Properties

General Settings

Property name Optional? Description
maven.patterntesting.src Yes

Location of project pattern tests. Default value is ${maven.src.dir}/test-aspect. No

Output dir for the template aspects. Default value is ${}/patterntesting/template. No

Output dir for compiled classes. Default value is ${}/patterntesting/classes.

maven.patterntesting.failonerror No

Decide whether to stop the build if Ajc fails. Default value is false.

maven.patterntesting.src.templates No

Location of the Pattern Tests Maven Templates (these are aspects that extend the generic aspects found in ${maven.patterntesting.src.suites} and use @xxx@ Ant token filters for defining where to apply the aspects.. Default value is aspect-template.

maven.patterntesting.excludes No

List of files to exclude from the ajc compilation. Default value is **/package.html.

maven.patterntesting.includes No

List of files to include in the ajc compilation. Default value is **/*.java,**/*.aj.

maven.patterntesting.conf.template No

Location of properties file that is used internally by the plugin to create Ant filters for the template properties. Default value is ${}/patterntesting/

maven.patterntesting.formatter No

Legal values are xml and plain. Default value is xml.