Flink要求使用JDK 11编译源代码,而其源/目标版本为1.8,原因何在?

huangapple go评论64阅读模式
英文:

Why does Flink require JDK 11 to compile the source code while its source/target is 1.8?

问题

我注意到Flink文档中提到:

> Flink要求至少使用Java 11进行构建。

另一方面,pom.xml中指定的源/目标版本是1.8:

<target.java.version>1.8</target.java.version>
...
	<source>${target.java.version}</source>
	<target>${target.java.version}</target>
...

我的问题是:为什么Flink要求更高版本的JDK,而不是其pom规范中指定的版本?


更新

我尝试在我的计算机上使用Java 8构建Flink源代码,成功了!语句"Flink要求至少使用Java 11进行构建"实际上并没有什么意义,除非更高版本的JDK在构建时带来更好的性能(但我尚未验证这一点)。

java -version显示为OpenJDK 64位服务器VM Corretto-8.342.07.1(版本号为25.342-b07,混合模式)。

英文:

I noticed that Flink Doc says:

> Flink requires at least Java 11 to build.

On the other hand, the pom.xml specifies the source/target is 1.8:

<target.java.version>1.8</target.java.version>
...
	<source>${target.java.version}</source>
	<target>${target.java.version}</target>
...

My question is: why does Flink require a higher JDK than its pom specification?


Update

I tried to build Flink from source in my computer with Java 8, and it succeeded! The statement "Flink requires at least Java 11 to build." does not really make sense, except for the reason that higher JDK may bring better performance when building (but I didn't verify this yet).

The java -version is OpenJDK 64-Bit Server VM Corretto-8.342.07.1 (build 25.342-b07, mixed mode).

答案1

得分: 2

文档在实际代码要求之前被有意更改,以确保新开发人员从Java 11开始,因为这一变更将“很快”被要求。

来源:在pom.xml中将默认值更改为Java 11的Flink票证上的此评论,通过导航从更改文档文本的提交中链接的票证找到:

> 自从Java 8支持被弃用以来,Flink构建时使用Java 8的事实已被隐藏,以便新开发人员从一开始就使用Java 11进行开发。

英文:

The documentation was intentionally changed before the actual code requirement to make sure that new devs start with Java 11, as that change will "soon" be required.

Source: this comment on the Flink ticket to change the default in pom.xml to Java 11, found by navigating the tickets linked to from the commit that changed the text in the docs:

> That Flink does build with Java 8 was hidden from the docs since the deprecation of Java 8 support, so that new developers start developing with Java 11 from the get go.

huangapple
  • 本文由 发表于 2023年3月1日 16:33:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/75601233.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定