This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new da694a7a0fd CAMEL-20788: Update camel to use a newer 
protobuf-maven-plugin for gR… (#14516)
da694a7a0fd is described below

commit da694a7a0fdc29a6840e072ffd2730ffc78cb55f
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Thu Jun 13 20:06:54 2024 +0200

    CAMEL-20788: Update camel to use a newer protobuf-maven-plugin for gR… 
(#14516)
    
    CAMEL-20788: Update camel to use a newer protobuf-maven-plugin for gRPC. 
Thanks to Craig Ziesman for the patch.
---
 components/camel-grpc/pom.xml                      | 42 ++++++++++++++++------
 components/camel-protobuf/pom.xml                  | 40 ++++++++++++++++-----
 .../camel-salesforce-component/README.md           |  4 +++
 .../camel-salesforce-component/pom.xml             | 39 ++++++++++++++++----
 parent/pom.xml                                     |  2 +-
 5 files changed, 99 insertions(+), 28 deletions(-)

diff --git a/components/camel-grpc/pom.xml b/components/camel-grpc/pom.xml
index e5b2f509c3b..3ad0a5b72ae 100644
--- a/components/camel-grpc/pom.xml
+++ b/components/camel-grpc/pom.xml
@@ -194,28 +194,48 @@
 
             <!-- gRPC and protobuf Java code generator plugin -->
             <plugin>
-                <groupId>org.xolstice.maven.plugins</groupId>
+                <groupId>io.github.ascopes</groupId>
                 <artifactId>protobuf-maven-plugin</artifactId>
                 <version>${protobuf-maven-plugin-version}</version>
                 <configuration>
-                    
<protocArtifact>com.google.protobuf:protoc:${protobuf-version}:exe:${os.detected.classifier}
-                    </protocArtifact>
-                    <pluginId>grpc-java</pluginId>
-                    
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc-version}:exe:${os.detected.classifier}
-                    </pluginArtifact>
-                    <checkStaleness>true</checkStaleness>
-                    <skip>${skipTests}</skip>
+                    <protocVersion>${protobuf-version}</protocVersion>
+                    <sourceDirectories>
+                        <sourceDirectory>src/test/proto</sourceDirectory>
+                    </sourceDirectories>
+                    <binaryMavenPlugins>
+                        <binaryMavenPlugin>
+                            <groupId>io.grpc</groupId>
+                            <artifactId>protoc-gen-grpc-java</artifactId>
+                            <version>${grpc-version}</version>
+                        </binaryMavenPlugin>
+                    </binaryMavenPlugins>
                 </configuration>
                 <executions>
                     <execution>
                         <goals>
-                            <goal>test-compile</goal>
-                            <goal>test-compile-custom</goal>
+                            <goal>generate-test</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>
-
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>add-test-source</id>
+                        <phase>generate-test-sources</phase>
+                        <goals>
+                            <goal>add-test-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                
<source>target/generated-test-sources/protobuf</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <executions>
diff --git a/components/camel-protobuf/pom.xml 
b/components/camel-protobuf/pom.xml
index 8169d029ae6..430eaaa64be 100644
--- a/components/camel-protobuf/pom.xml
+++ b/components/camel-protobuf/pom.xml
@@ -115,26 +115,48 @@
 
             <!-- Protobuf Java code generator plugin -->
             <plugin>
-                <groupId>org.xolstice.maven.plugins</groupId>
+                <groupId>io.github.ascopes</groupId>
                 <artifactId>protobuf-maven-plugin</artifactId>
                 <version>${protobuf-maven-plugin-version}</version>
-                <extensions>true</extensions>
+                <configuration>
+                    <protocVersion>${protobuf-version}</protocVersion>
+                    <sourceDirectories>
+                        <sourceDirectory>src/test/proto</sourceDirectory>
+                    </sourceDirectories>
+                    <binaryMavenPlugins>
+                        <binaryMavenPlugin>
+                            <groupId>io.grpc</groupId>
+                            <artifactId>protoc-gen-grpc-java</artifactId>
+                            <version>${grpc-version}</version>
+                        </binaryMavenPlugin>
+                    </binaryMavenPlugins>
+                </configuration>
                 <executions>
                     <execution>
                         <goals>
-                            <goal>test-compile</goal>
+                            <goal>generate-test</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>add-test-source</id>
+                        <phase>generate-test-sources</phase>
+                        <goals>
+                            <goal>add-test-source</goal>
                         </goals>
                         <configuration>
-                            <protocArtifact>
-                                
com.google.protobuf:protoc:${protobuf-version}:exe:${os.detected.classifier}
-                            </protocArtifact>
-                            <checkStaleness>true</checkStaleness>
-                            <skip>${skipTests}</skip>
+                            <sources>
+                                
<source>target/generated-test-sources/protobuf</source>
+                            </sources>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>
-
             <plugin>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <executions>
diff --git a/components/camel-salesforce/camel-salesforce-component/README.md 
b/components/camel-salesforce/camel-salesforce-component/README.md
index ce9809bfca6..51279b72e34 100644
--- a/components/camel-salesforce/camel-salesforce-component/README.md
+++ b/components/camel-salesforce/camel-salesforce-component/README.md
@@ -5,6 +5,10 @@ There is a companion maven plugin 
[camel-salesforce-plugin](https://github.com/a
 
 ## Developing the Camel Salesforce component
 
+### Building on Windows/ARM
+
+**Note:** There is no `protoc` compiler available for Windows on ARM, so this 
component will fail to build in that environment. An issue has been raised 
against the `protobuf` project to request an executable for Windows on ARM. 
https://github.com/protocolbuffers/protobuf/issues/16877
+
 ### Running the integration tests
 
 **Note:** These instructions are only for running integration tests, they use 
permissions and IP restrictions that should be reconsidered for production use. 
diff --git a/components/camel-salesforce/camel-salesforce-component/pom.xml 
b/components/camel-salesforce/camel-salesforce-component/pom.xml
index 642c9bb3e98..806c40788e2 100644
--- a/components/camel-salesforce/camel-salesforce-component/pom.xml
+++ b/components/camel-salesforce/camel-salesforce-component/pom.xml
@@ -256,23 +256,48 @@
                 </executions>
             </plugin>
             <plugin>
-                <groupId>org.xolstice.maven.plugins</groupId>
+                <groupId>io.github.ascopes</groupId>
                 <artifactId>protobuf-maven-plugin</artifactId>
                 <version>${protobuf-maven-plugin-version}</version>
                 <configuration>
-                    
<protocArtifact>com.google.protobuf:protoc:${protobuf-version}:exe:${os.detected.classifier}</protocArtifact>
-                    <pluginId>grpc-java</pluginId>
-                    
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc-version}:exe:${os.detected.classifier}</pluginArtifact>
+                    <protocVersion>${protobuf-version}</protocVersion>
+                    <sourceDirectories>
+                        <sourceDirectory>src/main/proto</sourceDirectory>
+                    </sourceDirectories>
+                    <binaryMavenPlugins>
+                        <binaryMavenPlugin>
+                            <groupId>io.grpc</groupId>
+                            <artifactId>protoc-gen-grpc-java</artifactId>
+                            <version>${grpc-version}</version>
+                        </binaryMavenPlugin>
+                    </binaryMavenPlugins>
                 </configuration>
                 <executions>
                     <execution>
                         <goals>
-                            <goal>compile</goal>
-                            <goal>compile-custom</goal>
+                            <goal>generate</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                
<source>target/generated-sources/protobuf</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <!-- Remove it once 
https://github.com/grpc/grpc-java/issues/9179 is resolved -->
                 <artifactId>maven-antrun-plugin</artifactId>
@@ -283,7 +308,7 @@
                             <target>
                                 <replace token= "@javax.annotation.Generated"
                                          value="@jakarta.annotation.Generated"
-                                         
dir="target/generated-sources/protobuf/grpc-java">
+                                         
dir="target/generated-sources/protobuf">
                                     <include name="**/*.java"/>
                                 </replace>
                             </target>
diff --git a/parent/pom.xml b/parent/pom.xml
index 3f528ad64b2..456ec091635 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -404,7 +404,7 @@
         
<properties-maven-plugin-version>1.2.1</properties-maven-plugin-version>
         
<proto-google-common-protos-version>2.22.0</proto-google-common-protos-version>
         <protobuf-version>3.25.3</protobuf-version>
-        <protobuf-maven-plugin-version>0.6.1</protobuf-maven-plugin-version>
+        <protobuf-maven-plugin-version>2.1.4</protobuf-maven-plugin-version>
         <protonpack-version>1.8</protonpack-version>
         <protostream-version>5.0.5.Final</protostream-version>
         <prowide-version>SRU2023-10.1.6</prowide-version>

Reply via email to