Files
airflow/java-sdk/scala_spark_example
566e9f3c27 Bump Java SDK dependencies with Java 11 compatibility (#71670)
* Bump the java-sdk-dependency-updates group across 2 directories with 22 updates

Bumps the java-sdk-dependency-updates group with 15 updates in the /java-sdk directory:

| Package | From | To |
| --- | --- | --- |
| org.apache.logging.log4j:log4j-core | `2.26.0` | `2.26.1` |
| [com.gradleup.shadow:shadow-gradle-plugin](https://github.com/GradleUp/shadow) | `9.1.0` | `9.6.1` |
| [com.github.spotbugs:spotbugs-annotations](https://github.com/spotbugs/spotbugs) | `4.9.8` | `4.10.3` |
| [com.fasterxml.jackson.core:jackson-annotations](https://github.com/FasterXML/jackson) | `2.21` | `2.22` |
| [com.fasterxml.jackson.dataformat:jackson-dataformat-yaml](https://github.com/FasterXML/jackson-dataformats-text) | `2.21.0` | `2.22.1` |
| com.fasterxml.jackson.datatype:jackson-datatype-jsr310 | `2.21.0` | `2.22.1` |
| [io.ktor:ktor-network](https://github.com/ktorio/ktor) | `3.3.3` | `3.5.1` |
| [org.jetbrains.kotlinx:kotlinx-coroutines-core](https://github.com/Kotlin/kotlinx.coroutines) | `1.10.2` | `1.11.0` |
| [org.jetbrains.kotlinx:kotlinx-datetime](https://github.com/Kotlin/kotlinx-datetime) | `0.7.1` | `0.8.0` |
| [org.jetbrains.kotlinx:kotlinx-serialization-json](https://github.com/Kotlin/kotlinx.serialization) | `1.10.0` | `1.11.0` |
| [org.msgpack:msgpack-core](https://github.com/msgpack/msgpack-java) | `0.9.11` | `0.9.12` |
| org.jsonschema2pojo | `1.2.2` | `1.3.3` |
| [plugin.serialization](https://github.com/JetBrains/kotlin) | `2.3.0` | `2.4.10` |
| [org.jetbrains.kotlin:kotlin-gradle-plugin](https://github.com/JetBrains/kotlin) | `2.3.0` | `2.4.10` |
| [gradle-wrapper](https://github.com/gradle/gradle) | `8.14.4` | `8.14.5` |

Bumps the java-sdk-dependency-updates group with 3 updates in the /java-sdk/scala_spark_example directory: [org.scala-lang:scala-library](https://github.com/scala/scala), org.apache.spark:spark-sql_2.13 and [org.apache.logging.log4j:log4j-bom](https://github.com/apache/logging-log4j2).

Updates `org.apache.logging.log4j:log4j-core` from 2.26.0 to 2.26.1

Updates `org.apache.logging.log4j:log4j-api` from 2.26.0 to 2.26.1

Updates `com.gradleup.shadow:shadow-gradle-plugin` from 9.1.0 to 9.6.1
- [Release notes](https://github.com/GradleUp/shadow/releases)
- [Commits](https://github.com/GradleUp/shadow/compare/9.1.0...9.6.1)

Updates `com.github.spotbugs:spotbugs-annotations` from 4.9.8 to 4.10.3
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.9.8...4.10.3)

Updates `com.fasterxml.jackson.core:jackson-annotations` from 2.21 to 2.22
- [Commits](https://github.com/FasterXML/jackson/commits)

Updates `com.fasterxml.jackson.core:jackson-core` from 2.21.1 to 2.22.1
- [Commits](https://github.com/FasterXML/jackson-core/compare/jackson-core-2.21.1...jackson-core-2.22.1)

Updates `com.fasterxml.jackson.core:jackson-databind` from 2.21.0 to 2.22.0
- [Commits](https://github.com/FasterXML/jackson/commits)

Updates `com.fasterxml.jackson.dataformat:jackson-dataformat-yaml` from 2.21.0 to 2.22.1
- [Commits](https://github.com/FasterXML/jackson-dataformats-text/compare/jackson-dataformats-text-2.21.0...jackson-dataformats-text-2.22.1)

Updates `com.fasterxml.jackson.datatype:jackson-datatype-jsr310` from 2.21.0 to 2.22.1

Updates `io.ktor:ktor-network` from 3.3.3 to 3.5.1
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/compare/3.3.3...3.5.1)

Updates `org.jetbrains.kotlinx:kotlinx-coroutines-core` from 1.10.2 to 1.11.0
- [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md)
- [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.10.2...1.11.0)

Updates `org.jetbrains.kotlinx:kotlinx-datetime` from 0.7.1 to 0.8.0
- [Release notes](https://github.com/Kotlin/kotlinx-datetime/releases)
- [Changelog](https://github.com/Kotlin/kotlinx-datetime/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Kotlin/kotlinx-datetime/compare/v0.7.1...v0.8.0)

Updates `org.jetbrains.kotlinx:kotlinx-serialization-json` from 1.10.0 to 1.11.0
- [Release notes](https://github.com/Kotlin/kotlinx.serialization/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.serialization/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Kotlin/kotlinx.serialization/compare/v1.10.0...v1.11.0)

Updates `org.msgpack:msgpack-core` from 0.9.11 to 0.9.12
- [Release notes](https://github.com/msgpack/msgpack-java/releases)
- [Changelog](https://github.com/msgpack/msgpack-java/blob/main/RELEASE_NOTES.md)
- [Commits](https://github.com/msgpack/msgpack-java/compare/v0.9.11...v0.9.12)

Updates `org.msgpack:jackson-dataformat-msgpack` from 0.9.11 to 0.9.12
- [Release notes](https://github.com/msgpack/msgpack-java/releases)
- [Changelog](https://github.com/msgpack/msgpack-java/blob/main/RELEASE_NOTES.md)
- [Commits](https://github.com/msgpack/msgpack-java/compare/v0.9.11...v0.9.12)

Updates `org.jsonschema2pojo` from 1.2.2 to 1.3.3

Updates `plugin.serialization` from 2.3.0 to 2.4.10
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v2.3.0...v2.4.10)

Updates `org.jetbrains.kotlin:kotlin-gradle-plugin` from 2.3.0 to 2.4.10
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v2.3.0...v2.4.10)

Updates `gradle-wrapper` from 8.14.4 to 8.14.5
- [Release notes](https://github.com/gradle/gradle/releases)
- [Commits](https://github.com/gradle/gradle/compare/v8.14.4...v8.14.5)

Updates `org.scala-lang:scala-library` from 2.13.8 to 2.13.18
- [Release notes](https://github.com/scala/scala/releases)
- [Commits](https://github.com/scala/scala/compare/v2.13.8...v2.13.18)

Updates `org.apache.spark:spark-sql_2.13` from 3.5.8 to 3.5.9

Updates `org.apache.logging.log4j:log4j-bom` from 2.26.0 to 2.26.1
- [Release notes](https://github.com/apache/logging-log4j2/releases)
- [Changelog](https://github.com/apache/logging-log4j2/blob/2.x/RELEASE-NOTES.adoc)
- [Commits](https://github.com/apache/logging-log4j2/compare/rel/2.26.0...rel/2.26.1)

---
updated-dependencies:
- dependency-name: org.apache.logging.log4j:log4j-core
  dependency-version: 2.26.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: java-sdk-dependency-updates
- dependency-name: org.apache.logging.log4j:log4j-api
  dependency-version: 2.26.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: java-sdk-dependency-updates
- dependency-name: com.gradleup.shadow:shadow-gradle-plugin
  dependency-version: 9.6.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: java-sdk-dependency-updates
- dependency-name: com.github.spotbugs:spotbugs-annotations
  dependency-version: 4.10.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: java-sdk-dependency-updates
- dependency-name: com.fasterxml.jackson.core:jackson-annotations
  dependency-version: '2.22'
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: java-sdk-dependency-updates
- dependency-name: com.fasterxml.jackson.core:jackson-core
  dependency-version: 2.22.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: java-sdk-dependency-updates
- dependency-name: com.fasterxml.jackson.core:jackson-databind
  dependency-version: 2.22.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: java-sdk-dependency-updates
- dependency-name: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml
  dependency-version: 2.22.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: java-sdk-dependency-updates
- dependency-name: com.fasterxml.jackson.datatype:jackson-datatype-jsr310
  dependency-version: 2.22.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: java-sdk-dependency-updates
- dependency-name: io.ktor:ktor-network
  dependency-version: 3.5.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: java-sdk-dependency-updates
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-core
  dependency-version: 1.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: java-sdk-dependency-updates
- dependency-name: org.jetbrains.kotlinx:kotlinx-datetime
  dependency-version: 0.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: java-sdk-dependency-updates
- dependency-name: org.jetbrains.kotlinx:kotlinx-serialization-json
  dependency-version: 1.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: java-sdk-dependency-updates
- dependency-name: org.msgpack:msgpack-core
  dependency-version: 0.9.12
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: java-sdk-dependency-updates
- dependency-name: org.msgpack:jackson-dataformat-msgpack
  dependency-version: 0.9.12
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: java-sdk-dependency-updates
- dependency-name: org.jsonschema2pojo
  dependency-version: 1.3.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: java-sdk-dependency-updates
- dependency-name: plugin.serialization
  dependency-version: 2.4.10
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: java-sdk-dependency-updates
- dependency-name: org.jetbrains.kotlin:kotlin-gradle-plugin
  dependency-version: 2.4.10
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: java-sdk-dependency-updates
- dependency-name: gradle-wrapper
  dependency-version: 8.14.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: java-sdk-dependency-updates
- dependency-name: org.scala-lang:scala-library
  dependency-version: 2.13.18
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: java-sdk-dependency-updates
- dependency-name: org.apache.spark:spark-sql_2.13
  dependency-version: 3.5.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: java-sdk-dependency-updates
- dependency-name: org.apache.logging.log4j:log4j-bom
  dependency-version: 2.26.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: java-sdk-dependency-updates
...

Signed-off-by: dependabot[bot] <support@github.com>

* Keep shadow-gradle-plugin on 9.1.0 and refresh dependency verification metadata

shadow-gradle-plugin 9.6.1 declares org.gradle.plugin.api-version 9.2.0 and
Java 17 compatibility, but the java-sdk plugin project compiles against Java 11
on Gradle 8.14.5, so resolution fails outright. 9.1.0 is the last release that
supports Java 11, which is what the pin's comment already recorded.

Gradle strict verification rejects any artifact absent from
verification-metadata.xml, and the remaining bumps in this group resolve
artifacts the committed file does not describe.

* Store gradlew.bat with LF endings as .gitattributes requires

The regenerated wrapper landed in the repository with CRLF bytes, but
java-sdk/.gitattributes marks *.bat as 'text eol=crlf', meaning LF in the
object store and CRLF on checkout. The mismatch left the file permanently
dirty in every working tree and blocked rebases. Windows checkouts still
get CRLF.

* Keep Java SDK dependency updates compatible with Java 11

Keep jsonschema2pojo and Shadow at versions that load on Java 11. Use published Jackson coordinates, align dependency submission on Gradle 8.14.5, and regenerate verification metadata from the resolved graph.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
2026-08-17 09:48:52 +08:00
..
…

Scala Spark example bundle

A Scala + Apache Spark bundle for the Java SDK, exercised by the java_sdk end-to-end test. It shows a non-Java JVM language driving Spark from a @task.stub task and routing Log4j 2 logs into Airflow via airflow-sdk-log4j2.

The scala_spark_example Dag chains three tasks, each running in its own JVM with a local SparkSession and passing scalar results over XCom:

  • spark_extract - builds a DataFrame, pushes its row count.
  • spark_transform - aggregates total revenue.
  • spark_load - returns the persisted total.

Build

# From java-sdk/: publish the SDK to the local Maven repository first.
./gradlew publishToMavenLocal -PskipSigning=true

cd scala_spark_example
../gradlew bundle

fatJar is disabled, so build/bundle/ holds the bundle JAR plus every runtime JAR (Spark included) — copy it into a Java coordinator's jars_root.

Running Spark under the Java SDK

Spark on Java 17 needs a set of --add-opens / --add-exports options that open internal JDK modules (reflection, NIO, the off-heap cleaner, Kerberos, ...) to Spark. spark-submit and the SparkSession builder inject these through Spark's own launcher, but the Java SDK's JavaCoordinator starts the bundle JVM directly and bypasses that launcher, so the coordinator has to pass them itself via jvm_args:

{
  "scala-jdk": {
    "classpath": "airflow.sdk.coordinators.java.JavaCoordinator",
    "kwargs": {
      "jars_root": ["/path/to/scala-jars"],
      "main_class": "org.apache.airflow.example.ScalaSparkBundleBuilder",
      "jvm_args": [
        "-Xmx512m",
        "-XX:+IgnoreUnrecognizedVMOptions",
        "--add-opens=java.base/java.lang=ALL-UNNAMED",
        "--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED",
        "--add-opens=java.base/sun.nio.ch=ALL-UNNAMED"
      ]
    }
  }
}

The full list mirrors org.apache.spark.launcher.JavaModuleOptions for the Spark version pinned in build.gradle. Spark may add or drop openings between releases, so revisit it whenever you bump Spark. The end-to-end test keeps the authoritative, complete copy in airflow-e2e-tests/tests/airflow_e2e_tests/conftest.py (_SPARK_JAVA_MODULE_OPTIONS).