Skip to content

Commit 45c6be6

Browse files
build(grpc): upgrade protobuf-maven-plugin to 5.1.7 (a2aproject#994)
Migrate all protobuf compilation to io.github.ascopes:protobuf-maven-plugin 5.1.7, replacing both the hardcoded 4.1.2 in spec-grpc and the legacy org.xolstice.maven.plugins plugin in compat-0.3/spec-grpc: - Centralize version in parent POM property - Update plugin configuration to v5.x API (protoc, plugins, goals) - Add GitHub Actions workflow to verify gRPC code generation in CI Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 4b0a1f7 commit 45c6be6

4 files changed

Lines changed: 54 additions & 16 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Verify gRPC Generation
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
# Only run the latest job
9+
concurrency:
10+
group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}'
11+
cancel-in-progress: true
12+
13+
jobs:
14+
verify-grpc-generation:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v6
18+
- name: Set up JDK 21
19+
uses: actions/setup-java@v5
20+
with:
21+
java-version: '21'
22+
distribution: 'temurin'
23+
cache: maven
24+
- name: Verify gRPC code generation
25+
# -pl: build only spec-grpc and compat-0.3/spec-grpc modules
26+
# -am: also build their dependencies
27+
# -Dskip.protobuf.generate=false: enable protoc generation in spec-grpc (skipped by default)
28+
# -Pproto-compile: activate the proto-compile profile in compat-0.3/spec-grpc
29+
run: mvn install -B -DskipTests -pl spec-grpc,compat-0.3/spec-grpc -am -Dskip.protobuf.generate=false -Pproto-compile

‎compat-0.3/spec-grpc/pom.xml‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
<profile>
9696
<id>proto-compile</id>
9797
<build>
98-
9998
<plugins>
10099
<plugin>
101100
<groupId>org.apache.maven.plugins</groupId>
@@ -125,21 +124,29 @@
125124
</plugin>
126125
<!-- Protocol Buffers Compiler Plugin -->
127126
<plugin>
128-
<groupId>org.xolstice.maven.plugins</groupId>
127+
<groupId>io.github.ascopes</groupId>
129128
<artifactId>protobuf-maven-plugin</artifactId>
130129
<version>${protobuf-maven-plugin.version}</version>
131130
<configuration>
132-
<protocArtifact>com.google.protobuf:protoc:${protobuf-java.version}:exe:${os.detected.classifier}</protocArtifact>
133-
<pluginId>grpc-java</pluginId>
134-
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
135-
<outputDirectory>src/main/java</outputDirectory>
136-
<clearOutputDirectory>false</clearOutputDirectory>
131+
<skip>${skip.protobuf.generate}</skip>
132+
<cleanOutputDirectories>true</cleanOutputDirectories>
133+
<protoc kind="binary-maven">
134+
<version>${protobuf-java.version}</version>
135+
</protoc>
136+
<outputDirectory>${project.basedir}/src/main/java/</outputDirectory>
137+
<plugins>
138+
<plugin kind="binary-maven">
139+
<groupId>io.grpc</groupId>
140+
<artifactId>protoc-gen-grpc-java</artifactId>
141+
<version>${grpc.version}</version>
142+
</plugin>
143+
</plugins>
137144
</configuration>
138145
<executions>
139146
<execution>
147+
<phase>generate-sources</phase>
140148
<goals>
141-
<goal>compile</goal>
142-
<goal>compile-custom</goal>
149+
<goal>generate</goal>
143150
</goals>
144151
</execution>
145152
</executions>

‎pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<mutiny-zero.version>1.1.1</mutiny-zero.version>
6565
<os-maven-plugin.version>1.7.1</os-maven-plugin.version>
6666
<protobuf-java.version>4.33.2</protobuf-java.version>
67-
<protobuf-maven-plugin.version>0.6.1</protobuf-maven-plugin.version>
67+
<protobuf-maven-plugin.version>5.1.7</protobuf-maven-plugin.version>
6868
<quarkus.platform.version>3.36.3</quarkus.platform.version>
6969
<rest-assured.version>6.0.0</rest-assured.version>
7070
<slf4j.version>2.0.18</slf4j.version>

‎spec-grpc/pom.xml‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,21 @@
9696
<plugin>
9797
<groupId>io.github.ascopes</groupId>
9898
<artifactId>protobuf-maven-plugin</artifactId>
99-
<version>4.1.2</version>
99+
<version>${protobuf-maven-plugin.version}</version>
100100
<configuration>
101101
<skip>${skip.protobuf.generate}</skip>
102102
<cleanOutputDirectories>true</cleanOutputDirectories>
103-
<protoc>${protobuf-java.version}</protoc>
103+
<protoc kind="binary-maven">
104+
<version>${protobuf-java.version}</version>
105+
</protoc>
104106
<outputDirectory>${project.basedir}/src/main/java/</outputDirectory>
105-
<binaryMavenPlugins>
106-
<binaryMavenPlugin>
107+
<plugins>
108+
<plugin kind="binary-maven">
107109
<groupId>io.grpc</groupId>
108110
<artifactId>protoc-gen-grpc-java</artifactId>
109111
<version>${grpc.version}</version>
110-
</binaryMavenPlugin>
111-
</binaryMavenPlugins>
112+
</plugin>
113+
</plugins>
112114
</configuration>
113115
<executions>
114116
<execution>

0 commit comments

Comments
 (0)