Skip to content

Commit 3b296cc

Browse files
authored
Fix API compatibility workflow failing when building previous version (#2694)
The workflow is currently failing for the jpms-test module: > Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project jpms-test: > Fatal error compiling: error: bad value for --module-version option: 'JAPICMP-OLD' Therefore this commit changes the dummy version number format.
1 parent 6ebbc9d commit 3b296cc

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

.github/workflows/check-api-compatibility.yml

+12-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,17 @@ jobs:
88
check-api-compatibility:
99
runs-on: ubuntu-latest
1010

11+
# This setup tries to determine API incompatibility only for the changes introduced by the
12+
# pull request. It does this by first checking out the 'old' version and installing it into
13+
# the local Maven repository before then using japicmp to compare it to the current changes.
14+
#
15+
# Alternatively it would also be possible to compare against the last release version instead.
16+
#
17+
# Both approaches have their advantages and disadvantages, see description of
18+
# https://github.com/google/gson/pull/2692 for details.
19+
1120
steps:
12-
- name: Checkout old version
21+
- name: Check out old version
1322
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
1423
with:
1524
ref: ${{ github.event.pull_request.base.sha }}
@@ -26,11 +35,11 @@ jobs:
2635
run: |
2736
cd gson-old-japicmp
2837
# Set dummy version
29-
mvn --batch-mode --no-transfer-progress org.codehaus.mojo:versions-maven-plugin:2.11.0:set -DnewVersion=JAPICMP-OLD
38+
mvn --batch-mode --no-transfer-progress org.codehaus.mojo:versions-maven-plugin:2.16.2:set "-DnewVersion=0.0.0-JAPICMP-OLD"
3039
# Install artifacts with dummy version in local repository; used later by Maven plugin for comparison
3140
mvn --batch-mode --no-transfer-progress install -DskipTests
3241
33-
- name: Checkout new version
42+
- name: Check out new version
3443
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
3544

3645
- name: Check API compatibility

pom.xml

+4-6
Original file line numberDiff line numberDiff line change
@@ -477,14 +477,12 @@
477477
<groupId>${project.groupId}</groupId>
478478
<artifactId>${project.artifactId}</artifactId>
479479
<!-- This is set by the GitHub workflow -->
480-
<version>JAPICMP-OLD</version>
480+
<version>0.0.0-JAPICMP-OLD</version>
481481
</dependency>
482482
</oldVersion>
483-
<newVersion>
484-
<file>
485-
<path>${project.build.directory}/${project.build.finalName}.${project.packaging}</path>
486-
</file>
487-
</newVersion>
483+
484+
<!-- 'new version' is automatically the version currently being build -->
485+
488486
<parameter>
489487
<breakBuildOnSourceIncompatibleModifications>true</breakBuildOnSourceIncompatibleModifications>
490488
<breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>

0 commit comments

Comments
 (0)