[
https://issues.apache.org/jira/browse/FLINK-40630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18114038#comment-18114038
]
Sylwester Lachiewicz commented on FLINK-40630:
----------------------------------------------
Findings on the Maven side, one per item in the description.
*1. release 8 overriding source 11 / target 17.* By design since Apache parent
36 ([#543|https://github.com/apache/maven-apache-parent/pull/543],
[#551|https://github.com/apache/maven-apache-parent/pull/551]): {{javaVersion}}
is the single knob and {{maven.compiler.source}}/{{target}} in a child are
ignored by maven-compiler-plugin 3.x. It cannot be fixed in the parent: the 4.x
compiler plugin forwards source, target and release verbatim and javac rejects
the combination, so the parent must not define source or target next to
release. Tracked as
[maven-apache-parent#608|https://github.com/apache/maven-apache-parent/issues/608];
[#609|https://github.com/apache/maven-apache-parent/pull/609] only removes the
JDK profiles and keeps release from {{javaVersion}}.
*2. javaVersion capping java17-target.* A profile in the child can override the
property. Verified against parent 39: the default build gets {{--release 11}},
a profile setting {{javaVersion}} to 17 gets {{--release 17}}.
*3. Blank release breaking javadoc.* A maven-javadoc-plugin bug, [MJAVADOC
#1376|https://github.com/apache/maven-javadoc-plugin/issues/1376]: the mojo
tests {{release != null}} and an empty string reaches {{charAt(0)}}. Fix in
[#1377|https://github.com/apache/maven-javadoc-plugin/pull/1377], CI green, for
3.12.1.
*4. add-exports rejected with release.* The compiler and javadoc
{{--add-exports}} in flink-connector-parent have no consumer: no connector
imports {{sun.net.util}}, {{sun.management}} or {{sun.rmi.registry}}, and
{{sun.security.krb5}} is imported only by flink-connector-hive. Test runtime is
unaffected: those exports go through {{surefire.module.config}} on the surefire
argLine, which javac never sees.
For flink-connector-parent this means {{javaVersion}} 11 with java17-target
overriding it to 17 works without any plugin change once the compiler and
javadoc {{--add-exports}} are gone, while the enforcer's {{requireJavaVersion}}
and the {{release}} profile still read {{maven.compiler.source}}/{{target}},
which the Apache parent no longer defines. Hive is the exception and needs
source/target with a blank release, which depends on maven-javadoc-plugin
3.12.1.
*5. Maven 3.9 floor.* Eleven connector repos have no wrapper (aws, jdbc,
elasticsearch, mongodb, opensearch, rabbitmq, cassandra, pulsar, gcp-pubsub,
hbase, prometheus), so the shared CI falls back to 3.8.6 for all of them; the
fallback is one line in flink-connector-shared-utils.
_This comment was created with AI assistance._
> Use Apache Parent POM 39 in flink-connector-parent
> --------------------------------------------------
>
> Key: FLINK-40630
> URL: https://issues.apache.org/jira/browse/FLINK-40630
> Project: Flink
> Issue Type: Technical Debt
> Components: Connectors / Common
> Reporter: Martijn Visser
> Priority: Major
>
> flink-connector-parent 2.0.0 still inherits from org.apache:apache:20 (2018).
> Apache Parent POM 39 is out and Flink itself moved in FLINK-40510.
> Two things break on the way and both were reproduced locally against
> flink-connector-kafka:
> Apache parent 39 activates a jdk9+ profile that sets
> {{maven.compiler.release}} to its {{javaVersion}} (8), and
> maven-compiler-plugin lets release override source/target. The connector
> parent sets source 11 / target 17 and no release, so the build fails outright
> rather than silently downgrading:
> {noformat}
> [INFO] Compiling 130 source files with javac [debug release 8] to
> target/classes
> [ERROR] TransactionOwnership.java:[74,29] method orElseThrow in class
> java.util.Optional<T> cannot be applied to given types
> {noformat}
> Setting javaVersion alone is not a fix, because it would also cap the
> java17-target profile at bytecode 55. Blanking {{maven.compiler.release}}
> fixes the compiler but breaks maven-javadoc-plugin (both 3.8.0 and 3.12.0)
> with "String index out of range: 0". What works is keeping the property
> non-empty and overriding the compiler plugin's release parameter instead.
> Second, javadoc rejects an add-exports J-option together with release
> ("exporting a package from system module java.base is not allowed with the
> release option"), so the add-exports option the parent's jdk profile passes
> to javadoc has to go. Whether any connector's javadoc actually needs it
> should be checked before the parent is released.
> Apache parent 39 also sets {{minimalMavenBuildVersion}} to 3.9 and enforces
> it in every module, so every connector adopting the new parent must build
> with Maven 3.9+. None of the other connector repos (aws, mongodb, opensearch,
> jdbc, elasticsearch, rabbitmq, cassandra) has a Maven wrapper at all, so the
> shared CI falls back to its hardcoded 3.8.6 for them. They need a wrapper, or
> the CI fallback has to move, before they take the new parent.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)