| /* | |
| * Licensed to the Apache Software Foundation (ASF) under one | |
| * or more contributor license agreements. See the NOTICE file | |
| * distributed with this work for additional information | |
| * regarding copyright ownership. The ASF licenses this file | |
| * to you under the Apache License, Version 2.0 (the | |
| * License); you may not use this file except in compliance | |
| * with the License. You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software | |
| * distributed under the License is distributed on an AS IS BASIS, | |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| * See the License for the specific language governing permissions and | |
| * limitations under the License. | |
| */ | |
| plugins { | |
| id 'java' | |
| id 'org.apache.beam.module' | |
| id 'com.gradleup.shadow' | |
| } | |
| applyJavaNature( | |
| exportJavadoc: false, | |
| automaticModuleName: 'org.apache.beam.examples.iceberg', | |
| // iceberg requires Java17+ | |
| requireJavaVersion: JavaVersion.VERSION_17 | |
| ) | |
| description = "Apache Beam :: Examples :: Java :: Iceberg" | |
| ext.summary = """Apache Beam Java SDK examples using IcebergIO.""" | |
| apply from: "$project.rootDir/examples/java/common.gradle" | |
| configurations { | |
| // Runtime classpath plus DataflowRunner for building Dataflow Flex Template uber-JARs. | |
| flexTemplateRuntime.extendsFrom runtimeClasspath | |
| } | |
| dependencies { | |
| implementation enforcedPlatform(library.java.google_cloud_platform_libraries_bom) | |
| runtimeOnly project(":sdks:java:io:iceberg") | |
| runtimeOnly project(":sdks:java:io:iceberg:bqms") | |
| runtimeOnly(project(":sdks:java:io:delta")) { | |
| exclude group: "org.apache.hadoop", module: "hadoop-aws" | |
| } | |
| implementation project(path: ":sdks:java:core", configuration: "shadow") | |
| implementation project(":sdks:java:extensions:google-cloud-platform-core") | |
| implementation project(":sdks:java:io:google-cloud-platform") | |
| implementation project(":sdks:java:managed") | |
| implementation library.java.delta_kernel_api | |
| implementation library.java.delta_kernel_defaults | |
| implementation library.java.google_auth_library_oauth2_http | |
| implementation library.java.hadoop_common | |
| implementation library.java.joda_time | |
| implementation library.java.slf4j_api | |
| runtimeOnly project(path: ":runners:direct-java", configuration: "shadow") | |
| implementation library.java.vendored_guava_32_1_2_jre | |
| runtimeOnly library.java.hadoop_client | |
| runtimeOnly library.java.bigdataoss_gcs_connector | |
| testImplementation library.java.hamcrest | |
| testImplementation library.java.junit | |
| // Provides DeltaWriteTestUtils, which writes Delta Lake tables for tests. | |
| testImplementation(project(path: ":sdks:java:io:delta", configuration: "testRuntimeMigration")) { | |
| exclude group: "org.apache.hadoop", module: "hadoop-aws" | |
| exclude group: "org.testcontainers" | |
| exclude group: "org.slf4j", module: "slf4j-simple" | |
| } | |
| // Add dependencies for the PreCommit configurations | |
| // For each runner a project level dependency on the examples project. | |
| for (String runner : preCommitRunners) { | |
| delegate.add(runner + "PreCommit", project(path: ":examples:java", configuration: "testRuntimeMigration")) | |
| } | |
| // Add dependency if requested on command line for runner | |
| if (project.hasProperty("runnerDependency")) { | |
| runtimeOnly project(path: project.getProperty("runnerDependency")) | |
| } | |
| flexTemplateRuntime project(":runners:google-cloud-dataflow-java") | |
| } | |
| tasks.register( | |
| 'deltaLakeToLakehouseCdcFlexTemplateJar', | |
| com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) { | |
| group = 'Build' | |
| description = 'Builds a Dataflow Flex Template uber-JAR for DeltaLakeToLakehouseCdcExample.' | |
| // Avoid duplicating the large shaded uber-JAR in the Gradle build cache. | |
| outputs.cacheIf { false } | |
| archiveBaseName.set('delta-lake-to-lakehouse-cdc-flex-template') | |
| archiveClassifier.set('bundled') | |
| from sourceSets.main.output | |
| configurations = [project.configurations.flexTemplateRuntime] | |
| mergeServiceFiles() | |
| append 'reference.conf' | |
| zip64 = true | |
| exclude 'META-INF/INDEX.LIST' | |
| exclude 'META-INF/*.SF' | |
| exclude 'META-INF/*.DSA' | |
| exclude 'META-INF/*.RSA' | |
| exclude 'META-INF/versions/**/module-info.class' | |
| manifest { | |
| attributes 'Main-Class': 'org.apache.beam.examples.iceberg.DeltaLakeToLakehouseCdcExample' | |
| } | |
| } | |
| configurations.all { | |
| // iceberg-core needs avro:1.12.0 | |
| resolutionStrategy.force 'org.apache.avro:avro:1.12.0' | |
| // The Delta Lake source reads tables on GCS through the GCS connector, whose version enforced by | |
| // the GCP libraries BOM conflicts with the latest Hadoop (see sdks/java/io/delta/build.gradle). So | |
| // use Hadoop 3.3 together with a compatible Parquet version. | |
| resolutionStrategy.force 'org.apache.hadoop:hadoop-client:3.3.6' | |
| resolutionStrategy.force 'org.apache.hadoop:hadoop-client-api:3.3.6' | |
| resolutionStrategy.force 'org.apache.hadoop:hadoop-client-runtime:3.3.6' | |
| resolutionStrategy.force 'org.apache.hadoop:hadoop-common:3.3.6' | |
| resolutionStrategy.force 'org.apache.hadoop:hadoop-hdfs:3.3.6' | |
| resolutionStrategy.force 'org.apache.hadoop:hadoop-hdfs-client:3.3.6' | |
| resolutionStrategy.force 'org.apache.parquet:parquet-avro:1.16.0' | |
| resolutionStrategy.force 'org.apache.parquet:parquet-hadoop:1.16.0' | |
| // Exclude conflicting SLF4J bindings pulled in by the Delta Lake and Hadoop dependencies. | |
| exclude group: "org.apache.logging.log4j", module: "log4j-slf4j2-impl" | |
| exclude group: "org.apache.logging.log4j", module: "log4j-slf4j-impl" | |
| exclude group: "org.slf4j", module: "slf4j-reload4j" | |
| } |