danielcweeks commented on PR #12721:
URL: https://github.com/apache/iceberg/pull/12721#issuecomment-2802614392

   Hey @wypoon I think we're approaching this the wrong way.  Rather than 
defining new projects to represent hive3&4, we can actually just run the tests 
against those dependencies by defining new dependency configurations.
   
   At the [configuration 
section](https://github.com/apache/iceberg/blob/main/build.gradle#L166) just 
add:
   
   ```groovy
     configurations {
       testImplementation.extendsFrom compileOnly
   
       . . .
   
       testArtifacts
       testHive2
       testHive3
       testHive4
     }
   ```
   
   Then just define the dependencies for these configurations in the current 
hive project:
   ```groovy
   project(':iceberg-hive-metastore') {
   
     dependencies {
   
       
testHive2("${libs.hive2.exec.get().module}:${libs.hive2.exec.get().getVersion()}:core")
 {
   
       . . .
   
       
testHive3("${libs.hive3.exec.get().module}:${libs.hive3.exec.get().getVersion()}:core")
 {
         exclude group: 'org.apache.avro', module: 'avro'
         exclude group: 'org.slf4j', module: 'slf4j-log4j12'
         exclude group: 'org.pentaho' // missing dependency
         exclude group: 'org.apache.hive', module: 'hive-llap-tez'
         exclude group: 'org.apache.logging.log4j'
         exclude group: 'com.google.protobuf', module: 'protobuf-java'
         exclude group: 'org.apache.calcite'
         exclude group: 'org.apache.calcite.avatica'
         exclude group: 'com.google.code.findbugs', module: 'jsr305'
       }
   
       testHive3(libs.hive3.metastore) {
         exclude group: 'org.apache.avro', module: 'avro'
         exclude group: 'org.slf4j', module: 'slf4j-log4j12'
         exclude group: 'org.pentaho' // missing dependency
         exclude group: 'org.apache.hbase'
         exclude group: 'org.apache.logging.log4j'
         exclude group: 'co.cask.tephra'
         exclude group: 'com.google.code.findbugs', module: 'jsr305'
         exclude group: 'org.eclipse.jetty.aggregate', module: 'jetty-all'
         exclude group: 'org.eclipse.jetty.orbit', module: 'javax.servlet'
         exclude group: 'org.apache.parquet', module: 'parquet-hadoop-bundle'
         exclude group: 'com.tdunning', module: 'json'
         exclude group: 'javax.transaction', module: 'transaction-api'
         exclude group: 'com.zaxxer', module: 'HikariCP'
       }
   
       testHive4(libs.hive4.metastore) {
   
       . . . 
   ```
   
   Then add the test tasks:
   
   ```
     tasks.register('testHive2', Test) {
       classpath = sourceSets.test.runtimeClasspath + configurations.testHive3
       testClassesDirs = sourceSets.test.output.classesDirs
       description = 'Run tests with Hive 2 dependencies'
     }
   
     tasks.register('testHive3', Test) {
       classpath = sourceSets.test.runtimeClasspath + configurations.testHive3
       testClassesDirs = sourceSets.test.output.classesDirs
       description = 'Run tests with Hive 3 dependencies'
     }
   
     tasks.register('testHive4', Test) {
       classpath = sourceSets.test.runtimeClasspath + configurations.testHive3
       testClassesDirs = sourceSets.test.output.classesDirs
       description = 'Run tests with Hive 4 dependencies'
     }
   ```
   
   This makes it a lot cleaner and means we don't have to worry about weird 
workarounds for the additional two projects.


-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to