Skip to content

[FLINK-41642][build] Consolidate Flink generation switching into the root pom - #4633

Open
sd4324530 wants to merge 3 commits into
apache:masterfrom
sd4324530:FLINK-41642-consolidate-generation-switching
Open

sd4324530 wants to merge 3 commits into
apache:masterfrom
sd4324530:FLINK-41642-consolidate-generation-switching

Conversation

@sd4324530

Copy link
Copy Markdown
Contributor

What is the purpose of this pull request?

Make the root pom the single Flink generation switch point. Today the 1.20-vs-2.2 switching is scattered across module-local flink1/flink2 profiles (cli, common, composer, runtime, connect, source-connectors, dist, pipeline-e2e-tests, plus the elasticsearch connector's local version switch) - and the root pom's flink2 profile did not even switch flink.version. After this PR a module carries no generation-scoped property of its own; enabling -Pflink2 at the root switches everything.

This is the second step of the multi-version compatibility refactor tracked in FLINK-41452 (sub-task: FLINK-41642), stacked on top of the module-rename PR, and is a pure property move: no effective value changes anywhere.

Brief change log

  • The root pom gains a flink.compat.artifactId default (flink-cdc-flink-1.20), and its flink2 profile now sets flink.version, flink.compat.artifactId and the elasticsearch connector version, alongside the kafka / paimon / iceberg / fluss versions it already switched.
  • The local switches are removed from cli, common, composer, runtime, connect, source-connectors, dist and pipeline-e2e-tests, together with the elasticsearch connector's local flink.connector.elasticsearch.version override. The modules take an unconditional ${flink.compat.artifactId} dependency instead of per-profile compat declarations, with the per-module scopes preserved exactly.
  • What stays module-local is genuinely module-local:
    • cli / common / composer / runtime keep a slim flink2 profile whose only job is to activate the root pom's flink2 test classpath machinery - the copy-flink2-guava execution and the surefire additional classpath elements are defined in the root pom's pluginManagement, and they only run for modules that declare the plugins. Removing those declarations would silently drop guava from the flink2 test classpath.
    • dist keeps only the 2.x shaded guava dependency in its flink2 profile; the 1.x flavor comes from the dependency inherited from the root pom.
    • connect keeps its compat test-jar machinery and copy-flink2-extra-libs unchanged; runtime keeps flink2-exclude-flink1. The guava handling is untouched.

Verifying this change

  • Full mvn clean install -DskipTests on JDK 11 for both generations (default and -Pflink2), with the repository gates (spotless / checkstyle) green.
  • Property equivalence: every switched property (flink.version, flink.compat.artifactId, the kafka and elasticsearch connector versions) evaluates to exactly the same values on both profiles as before the change (mvn help:evaluate on both profiles).
  • Artifact equivalence: the flink2-line dist and mysql connector fat jars are class-for-class identical to the build before this change (12,770 / 11,406 classes, no differences); the flink1-line fat jars still contain the complete compat class set (21 / 21 classes).
  • -Pflink2 unit tests of the core modules pass, and the copied guava33 jars are present in target/flink2-extra-libs, so the flink2 test classpath machinery is verified active.

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not applicable)

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: CodeBuddy (GLM-5.3)

…fic names

Rename flink-cdc-flink1-compat to flink-cdc-flink/flink-cdc-flink-1.20 and
flink-cdc-flink2-compat to flink-cdc-flink/flink-cdc-flink-2.2, nested under
a new flink-cdc-flink aggregate, so the compatibility layer is named after
the Flink version it targets and future lines can grow as sibling modules -
the layout used by Paimon and Fluss.

Pure rename: class content and build behavior are unchanged. References
updated accordingly: root pom modules, the compat dependency declarations,
neutralization profiles and test-classpath copy steps in cli, common,
composer, runtime, dist, connect and source-connectors, the shade include
wildcard in the SQL connector fat jar modules, the javadoc exclusion list
in docs.sh (switched to relative paths, since bare artifactIds only match
root-level modules), and AGENTS.md.

Verified on JDK 11 with full clean installs of both Flink generations
(default and -Pflink2; RAT skipped locally because of untracked draft
files - all touched headers are repo-standard). Every fat jar was checked
to still shade the complete compat class set: dist and SQL connector fat
jars on both lines contain all 21 / 38 classes respectively.
…c-compat

Per review feedback on apache#4632: the aggregate name flink-cdc-flink reads
confusingly next to its children (flink-cdc-flink-1.20 / -2.2). Use the
original flink-cdc-compat name for the aggregate directory and artifactId;
the child module names are unchanged.

Pure rename again: both generations build green, the fat jars are
class-for-class identical to the build before this change, and the javadoc
exclusion paths in docs.sh follow the new directory.
…root pom

The root pom becomes the single generation switch point: its flink2 profile
now sets flink.version and flink.compat.artifactId (plus the elasticsearch
connector version) that were previously switched by local flink1/flink2
profiles in cli, common, composer, runtime, connect, source-connectors,
dist, the elasticsearch connector and pipeline-e2e-tests.

What remains module-local is genuinely module-local:
* cli/common/composer/runtime keep a slim flink2 profile that only activates
  the root pom's flink2 test classpath machinery (copy-flink2-guava and the
  surefire additional classpath elements), and take an unconditional
  ${flink.compat.artifactId} dependency instead of per-profile compat deps.
* dist keeps only the 2.x shaded guava dependency in its flink2 profile (the
  1.x flavor comes from the inherited root dependency).
* connect keeps its compat test-jar machinery and copy-flink2-extra-libs
  unchanged; runtime keeps flink2-exclude-flink1; the guava handling is
  untouched.

Effective values are unchanged: every switched property evaluates to the
same value on both profiles, and the flink2-line dist and mysql fat jars are
class-for-class identical to the previous build (12770 / 11406 classes, no
differences). Both generations build green (full clean install, default and
-Pflink2) and the -Pflink2 unit tests of the core modules pass (the only
failures are the documented Windows-only CliFrontendTest / AiFunctionParserTest
cases that fail on master as well).
@sd4324530
sd4324530 force-pushed the FLINK-41642-consolidate-generation-switching branch from ea1ae18 to 9cffc70 Compare November 24, 2026 13:29

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant