NihalJain commented on code in PR #6366:
URL: https://github.com/apache/hbase/pull/6366#discussion_r1896653038


##########
pom.xml:
##########
@@ -925,13 +916,11 @@
     <lz4.version>1.8.0</lz4.version>
     <snappy.version>1.1.10.4</snappy.version>
     <zstd-jni.version>1.5.5-2</zstd-jni.version>
-    <!--
-        Note that the version of protobuf shipped in hbase-thirdparty must 
match the version used
-        in hbase-protocol-shaded and hbase-examples. The version of 
jackson-[annotations,core,
-        databind] must be kept in sync with the version of 
jackson-jaxrs-json-provider shipped in
-        hbase-thirdparty.
+    <hbase-thirdparty.version>4.1.10-SNAPSHOT</hbase-thirdparty.version>
+    <!--Version of protobuf that hbase uses internally (we shade our pb)
+         Must match what is out in hbase-thirdparty include.

Review Comment:
   > That's super annoying.
   > 
   > Okay but maybe there's a hack. Can we use the bundle and process goals 
from https://maven.apache.org/plugins/maven-remote-resources-plugin/index.html 
to package up this property and then import it from the hbase-protocol-shaded 
build via 
https://www.mojohaus.org/properties-maven-plugin/read-project-properties-mojo.html
 ?
   
   
   I tried this approach. Unfortunately this also did not work as "Properties 
used in plugin configurations must be available during the POM parsing phase." 
   
   We can read/inject a property only after parsing is done; So the 
`compile-protoc` would still build with whatever is set as initial value for 
`internal.protobuf.version` in pom.xml 
   
   
   Approach:
   Create a new module with hbase-thirdparty-properties-bundle/pom.xml
   
   ```
   <?xml version="1.0" encoding="UTF-8"?>
   <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns="http://maven.apache.org/POM/4.0.0";
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
       <modelVersion>4.0.0</modelVersion>
       <parent>
           <groupId>org.apache.hbase.thirdparty</groupId>
           <artifactId>hbase-thirdparty</artifactId>
           <version>${revision}</version>
           <relativePath>..</relativePath>
       </parent>
       <artifactId>hbase-thirdparty-properties-bundle</artifactId>
       <name>Apache HBase Thirdparty - Properties Bundle</name>
       <description>
           Properties Bundle, for shared properties between HBase Thirdparty 
and HBase main code
       </description>
       <build>
           <resources>
               <resource>
                   <directory>src/main/resources</directory>
                   <filtering>true</filtering>
               </resource>
           </resources>
           <plugins>
               <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-resources-plugin</artifactId>
                   <executions>
                       <execution>
                           <id>filter-resources</id>
                           <phase>process-resources</phase>
                           <goals>
                               <goal>resources</goal>
                           </goals>
                       </execution>
                   </executions>
               </plugin>
           </plugins>
       </build>
   </project>
   
   ```
   
   ---
   
   Create a properties to be shared: 
hbase-thirdparty-properties-bundle/src/main/resources/dependencies.properties
   ```
   internal.protobuf.version=${protobuf.version}
   ```
   
   ---
   Consume the resource in hbase/pom.xml
   ```
     <!-- Plugins to unpack properties file from hbase-thirdparty -->
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-dependency-plugin</artifactId>
           <executions>
             <execution>
               <id>unpack</id>
               <phase>initialize</phase>
               <goals>
                 <goal>unpack</goal>
               </goals>
               <configuration>
                 <artifactItems>
                   <artifactItem>
                     <groupId>org.apache.hbase.thirdparty</groupId>
                     <artifactId>hbase-thirdparty-properties-bundle</artifactId>
                     <version>${hbase-thirdparty.version}</version>
                     <overWrite>true</overWrite>
                     <!-- Specify the output directory -->
                     
<outputDirectory>${project.build.directory}/extracted-resources</outputDirectory>
                   </artifactItem>
                 </artifactItems>
               </configuration>
             </execution>
           </executions>
         </plugin>
         <!-- Properties Maven Plugin to read properties file unpacked via 
maven-dependency-plugin -->
         <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>properties-maven-plugin</artifactId>
           <version>1.2.1</version>
           <executions>
             <execution>
               <id>read-properties</id>
               <phase>initialize</phase>
               <goals>
                 <goal>read-project-properties</goal>
               </goals>
               <configuration>
                 <files>
                   
<file>${project.build.directory}/extracted-resources/dependencies.properties</file>
                 </files>
               </configuration>
             </execution>
           </executions>
         </plugin>
   ```
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to