Revapi

Full-featured API checker for Java and beyond.

This is a collection of tips & tricks to help you get started with Revapi and to take full advantage of its many configuration options.

Require Version Changes And Ignore Certain Codes

In situations where you want to require that certain version changes are made to have a passing build you can use the semver ignore extension. Additionally, if you are wanting to not ignore specific codes, for an example in Java, adding a method to an interface (java.method.addedToInterface), you can also use reclassify extension to turn BREAKING changes into EQUIVALENT changes. The configuration for these might work independently, but there really is not a guarantee of order that the extensions can be run, meaning that semver.ignore can be ran before the reclassify extension, causing the build to fail anyway. To get around this, a transform block can be used instead. The configuration of the extensions are still specified in the analysisConfiguration, but the pipelineConfiguration must also be specified to ensure that these extensions are run together and in a specific order.

                <plugin>
                    <groupId>org.revapi</groupId>
                    <artifactId>revapi-maven-plugin</artifactId>
                    <version>...</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.revapi</groupId>
                            <artifactId>revapi-java</artifactId>
                            <version>...</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <analysisConfiguration>
                            <revapi.reclassify>
                                <item>
                                    <code>java.method.addedToInterface</code>
                                    <classify>
                                        <BINARY>EQUIVALENT</BINARY>
                                        <SOURCE>EQUIVALENT</SOURCE>
                                        <SEMANTIC>EQUIVALENT</SEMANTIC>
                                    </classify>
                                </item>
                            </revapi.reclassify>
                            <revapi.semver.ignore>
                                <enabled>true</enabled>
                                <versionIncreaseAllows>
                                    <major>breaking</major>
                                    <minor>nonBreaking</minor>
                                    <patch>equivalent</patch>
                                </versionIncreaseAllows>
                            </revapi.semver.ignore>
                        </analysisConfiguration>
                        <pipelineConfiguration>
                            <transformBlocks>
                                <block>
                                    <item>revapi.reclassify</item>
                                    <item>revapi.semver.ignore</item>
                                </block>
                            </transformBlocks>
                        </pipelineConfiguration>
                    </configuration>
                </plugin>

Back to top

Msb3 Maven skin by Marek Romanowski.