Skip to content

Commit cd5a228

Browse files
pom: Check API changes against SemVer rules during build
Use japicmp to detect any changes in the public API compared to the previous release, and fail the build if the rules of semantic versioning are violated. This is run during the "verify" phase, just before the "install" phase. It also outputs the API differences in the target/japicmp folder.
1 parent f9ca939 commit cd5a228

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

pom.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
<version.gpg.plugin>1.5</version.gpg.plugin>
7878
<version.install.plugin>2.5.2</version.install.plugin>
7979
<version.jacoco.plugin>0.8.10</version.jacoco.plugin>
80+
<version.japicmp.plugin>0.20.0</version.japicmp.plugin>
8081
<version.javadoc.plugin>3.4.0</version.javadoc.plugin>
8182
<version.source.plugin>3.2.1</version.source.plugin>
8283
<version.jar.plugin>3.3.0</version.jar.plugin>
@@ -393,6 +394,11 @@
393394
<artifactId>jacoco-maven-plugin</artifactId>
394395
<version>${version.jacoco.plugin}</version>
395396
</plugin>
397+
<plugin>
398+
<groupId>com.github.siom79.japicmp</groupId>
399+
<artifactId>japicmp-maven-plugin</artifactId>
400+
<version>${version.japicmp.plugin}</version>
401+
</plugin>
396402
<plugin>
397403
<groupId>org.sonatype.plugins</groupId>
398404
<artifactId>nexus-staging-maven-plugin</artifactId>
@@ -457,6 +463,28 @@
457463
</execution>
458464
</executions>
459465
</plugin>
466+
467+
<plugin>
468+
<groupId>com.github.siom79.japicmp</groupId>
469+
<artifactId>japicmp-maven-plugin</artifactId>
470+
<configuration>
471+
<!-- Old and new versions are not specified, so we compare the latest released version with the build artefact -->
472+
<parameter>
473+
<!-- Break the build in case the semantic versioning is violated -->
474+
<breakBuildBasedOnSemanticVersioning>true</breakBuildBasedOnSemanticVersioning>
475+
<!-- Output only modified classes/methods in the report -->
476+
<onlyModified>true</onlyModified>
477+
</parameter>
478+
</configuration>
479+
<executions>
480+
<execution>
481+
<phase>verify</phase>
482+
<goals>
483+
<goal>cmp</goal>
484+
</goals>
485+
</execution>
486+
</executions>
487+
</plugin>
460488
</plugins>
461489
</build>
462490

0 commit comments

Comments
 (0)