Revapi Maven Plugin

Maven integration for Revapi.

By default Revapi will report all API changes of configured severity (by default "potentiallyBreaking") and the maven plugin will break the build if such differences are found since the last released version.

One then has to somehow "persuade" the plugin to let the build pass again. One way of doing it is to use the ignore extension and list all the changes and provide them with a "justification" for why such change happened.

This is very rigorous but also laborious approach that isn’t always worth the effort - especially in the early stages of development. Also one can argue that any change made to the codebase is intentional and therefore specifically listing it somewhere in a file that would justify such change to a tool is superfluous. On the other such strict policy might be required for some critical libraries that require high level of stability and any change should be vetted and approved.

There is also another way though. One can use the combination of the semver-ignore extension and the update-versions goal to (semi-)automatically increase the version of the library even during the development such that its version corresponds to the API changes it contains since the last released version. No other action like listing the and justifying the changes is necessary in this case.

For that you need to configure Revapi maven plugin to use and enable the semver-ignore extension:

<build>
    <plugin>
        <groupId>org.revapi</groupId>
        <artifactId>revapi-maven-plugin</artifactId>
        <configuration>
            <analysisConfiguration><![CDATA[
                {
                  "revapi": {
                    "semver": {
                      "ignore": {
                        "enabled": true
                      }
                    }
                  }
                }
            ]]></analysisConfiguration>
        </configuration>
    </plugin>
</build>

Then, when you try to build your project, revapi might find a change that is incompatible with the current version increase (like an API breaking change when you only increased a micro version since the last release) and fail your build. At that moment, it is enough to invoke:

mvn revapi:update-versions

and the version will be updated to reflect the API changes made. When you build the project again, the build should pass.

Note
You can even embed the update-versions goal in your regular build and have the versions increase automagically (at the cost of having to run the build twice when an incompatible change is made).

Back to top

Msb3 Maven skin by Marek Romanowski.