This is an automated email from the ASF dual-hosted git repository.
yhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new da6f7b4f212 Fix Build Issues with Iceberg Upgrade (#36255)
da6f7b4f212 is described below
commit da6f7b4f2126e28be4eee9fb199c18009170512e
Author: Tarun Annapareddy <[email protected]>
AuthorDate: Wed Sep 24 10:11:48 2025 -0700
Fix Build Issues with Iceberg Upgrade (#36255)
* Fix Build Issues with Iceberg Upgrade
* Add common build file
* Order import command
---
examples/java/build.gradle | 35 ++------------------------
examples/java/common.gradle | 50 ++++++++++++++++++++++++++++++++++++++
examples/java/iceberg/build.gradle | 7 ++++++
3 files changed, 59 insertions(+), 33 deletions(-)
diff --git a/examples/java/build.gradle b/examples/java/build.gradle
index 6f35a109998..cdbcb5ce8bf 100644
--- a/examples/java/build.gradle
+++ b/examples/java/build.gradle
@@ -36,6 +36,8 @@ ext.summary = """Apache Beam SDK provides a simple, Java-based
interface for processing virtually any size data. This
artifact includes all Apache Beam Java SDK examples."""
+apply from: "$projectDir/common.gradle"
+
/** Define the list of runners which execute a precommit test.
* Some runners are run from separate projects, see the preCommit task below
* for details.
@@ -174,39 +176,6 @@ task preCommit() {
}
}
-/*
- * A convenient task to run individual example directly on Beam repo.
- *
- * Usage:
- * ./gradlew :examples:java:execute
-PmainClass=org.apache.beam.examples.<ClassName>`\
- *
-Pexec.args="runner=[DataflowRunner|DirectRunner|FlinkRunner|SparkRunner|PrismRunner]
\
- * <pipeline options>"
- */
-tasks.create(name:"execute", type:JavaExec) {
- mainClass = project.hasProperty("mainClass") ?
project.getProperty("mainClass") : "NONE"
- def execArgs = project.findProperty("exec.args")
- String runner
- if (execArgs) {
- // configure runner dependency from args
- def runnerPattern = /runner[ =]([A-Za-z]+)/
- def matcher = execArgs =~ runnerPattern
- if (matcher) {
- runner = matcher[0][1]
- runner = runner.substring(0, 1).toLowerCase() + runner.substring(1);
- if (!(runner in (preCommitRunners + nonPreCommitRunners))) {
- throw new GradleException("Unsupported runner: " + runner)
- }
- }
- }
- if (runner) {
- classpath = sourceSets.main.runtimeClasspath +
configurations."${runner}PreCommit"
- } else {
- classpath = sourceSets.main.runtimeClasspath
- }
- systemProperties System.getProperties()
- args execArgs ? execArgs.split() : []
-}
-
// Run this task to validate the Java environment setup for contributors
task wordCount(type:JavaExec) {
description "Run the Java word count example"
diff --git a/examples/java/common.gradle b/examples/java/common.gradle
new file mode 100644
index 00000000000..b8a3ef27f9a
--- /dev/null
+++ b/examples/java/common.gradle
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+ /*
+ * A convenient task to run individual example directly on Beam repo.
+ *
+ * Usage:
+ * ./gradlew :examples:java:execute
-PmainClass=org.apache.beam.examples.<ClassName>`\
+ *
-Pexec.args="runner=[DataflowRunner|DirectRunner|FlinkRunner|SparkRunner|PrismRunner]
\
+ * <pipeline options>"
+ */
+tasks.create(name:"execute", type:JavaExec) {
+ mainClass = project.hasProperty("mainClass") ?
project.getProperty("mainClass") : "NONE"
+ def execArgs = project.findProperty("exec.args")
+ String runner
+ if (execArgs) {
+ // configure runner dependency from args
+ def runnerPattern = /runner[ =]([A-Za-z]+)/
+ def matcher = execArgs =~ runnerPattern
+ if (matcher) {
+ runner = matcher[0][1]
+ runner = runner.substring(0, 1).toLowerCase() + runner.substring(1);
+ if (!(runner in (preCommitRunners + nonPreCommitRunners))) {
+ throw new GradleException("Unsupported runner: " + runner)
+ }
+ }
+ }
+ if (runner) {
+ classpath = sourceSets.main.runtimeClasspath +
configurations."${runner}PreCommit"
+ } else {
+ classpath = sourceSets.main.runtimeClasspath
+ }
+ systemProperties System.getProperties()
+ args execArgs ? execArgs.split() : []
+}
diff --git a/examples/java/iceberg/build.gradle
b/examples/java/iceberg/build.gradle
index 09ef64d32ee..4d258e9be5a 100644
--- a/examples/java/iceberg/build.gradle
+++ b/examples/java/iceberg/build.gradle
@@ -33,6 +33,8 @@ applyJavaNature(
description = "Apache Beam :: Examples :: Java :: Iceberg"
ext.summary = """Apache Beam Java SDK examples using IcebergIO."""
+apply from: "$project.rootDir/examples/java/common.gradle"
+
/** Define the list of runners which execute a precommit test.
* Some runners are run from separate projects, see the preCommit task below
* for details.
@@ -87,3 +89,8 @@ dependencies {
runtimeOnly project(path: project.getProperty("runnerDependency"))
}
}
+
+configurations.all {
+ // iceberg-core needs avro:1.12.0
+ resolutionStrategy.force 'org.apache.avro:avro:1.12.0'
+}