Revapi Maven Plugin

Maven integration for Revapi.

By default, Revapi will automagically figure out the latest released version of your project and check the code that’s been built against it.

This is assumed to be the most common usecase and as such requires no additional configuration. But it always is not exactly what you want.

Specific Old Version

You can choose to explicitly select the old version to check. This is useful in scenarios where you need tell specifically the old version and Maven rules for determining the latest release does not pick the right one.

You can use one of the following configuration parameters of Revapi maven plugin:

  • oldArtifacts - This can be used to precisely specify the GAV (or more GAVs) of the artifact(s) representing your old version.

  • oldVersion - Using this, Revapi will reuse the groupId, artifactId, type and classifier of your currently built artifact and will use the specified version. I.e. using this, you can easily specify the older version of your artifact to check against.

Both of these parameters have their command-line names, too. Please consult the check goal docs for details.

Specific New Version

This is not a very common usecase but you can also specify the new version of the API (i.e. something different than what the Maven just built). Use newArtifacts or newVersion parameters with similar meaning to the old variants.

Leaving Out Pre-releases

Frequently, you will release alpha or beta versions before you release the final version of your project. Maven will consider any non-snapshot release as the latest, but that’s possibly not what you want to check against.

After you release a beta, you still want your project to be checked against the last final release, not against the beta.

You could explicitly specify the oldVersion to be your last final release but the caveat of that is that you will have to remember to change that after you release your new final release (so that your new final release becomes the new baseline for the future development).

There is a simpler way though.

You can use the versionFormat configuration parameter to specify how the version string of the latest release must look like.

For example if you use "GA" as the suffix of your final releases and you released 1.0.GA, 2.0.Alpha and 2.0.Beta, you can configure Revapi maven plugin like this:

<configuration>
  <versionFormat>.*\.GA</versionFormat>
</configuration>

and Revapi will use the latest release that matches that regular expression (which would be 1.0.GA) instead of the latest release as reported by Maven (which would be 2.0.Beta).

Note that the version format applies to both old and new versions and is only taken into account if the version string is one of the Maven’s special version specifiers - RELEASE or LATEST (RELEASE is the default value of oldVersion configuration parameter, so the above configuration will take effect).

Back to top

Msb3 Maven skin by Marek Romanowski.