Skip to content

Commit

Permalink
pom: Check API changes against SemVer rules during build
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bertrand-lorentz committed Mar 25, 2024
1 parent f9ca939 commit cd5a228
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<version.gpg.plugin>1.5</version.gpg.plugin>
<version.install.plugin>2.5.2</version.install.plugin>
<version.jacoco.plugin>0.8.10</version.jacoco.plugin>
<version.japicmp.plugin>0.20.0</version.japicmp.plugin>
<version.javadoc.plugin>3.4.0</version.javadoc.plugin>
<version.source.plugin>3.2.1</version.source.plugin>
<version.jar.plugin>3.3.0</version.jar.plugin>
Expand Down Expand Up @@ -393,6 +394,11 @@
<artifactId>jacoco-maven-plugin</artifactId>
<version>${version.jacoco.plugin}</version>
</plugin>
<plugin>
<groupId>com.github.siom79.japicmp</groupId>
<artifactId>japicmp-maven-plugin</artifactId>
<version>${version.japicmp.plugin}</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
Expand Down Expand Up @@ -457,6 +463,28 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.github.siom79.japicmp</groupId>
<artifactId>japicmp-maven-plugin</artifactId>
<configuration>
<!-- Old and new versions are not specified, so we compare the latest released version with the build artefact -->
<parameter>
<!-- Break the build in case the semantic versioning is violated -->
<breakBuildBasedOnSemanticVersioning>true</breakBuildBasedOnSemanticVersioning>
<!-- Output only modified classes/methods in the report -->
<onlyModified>true</onlyModified>
</parameter>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>cmp</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit cd5a228

Please sign in to comment.