Gradle,“sourceCompatibility” vs“targetCompatibility”? [英] Gradle, "sourceCompatibility" vs "targetCompatibility"?
问题描述
targetCompatibility
之间的关系/区别是什么?当它们设置为不同的值时会发生什么?
根据 Gradle文档:
$ b sourceCompatibility
在编译Java源代码时使用。
targetCompatibility
是用于生成类的Java版本。
我的理解是 targetCompatibility
将生成与特定版本的Java兼容的Java字节码,这是 sourceCompatibility
的功能的子集吗?
这通过映射到javac - 参见交叉编译部分 - 源代码基本上是源语言级别,目标是生成的字节代码级别。
What is the relationship/difference between sourceCompatibility
and targetCompatibility
? What happens when they are set to different values?
According to Gradle documentation:
sourceCompatibility
is "Java version compatibility to use when compiling Java source."
targetCompatibility
is "Java version to generate classes for."
My understanding is that targetCompatibility
will generate java bytecode that is compatible with a specific version of Java, is this a subset of the functionality of sourceCompatibility
?
this maps through to javac - see the cross compilation section - source is basically the source language level and target is the level of the bytecode that is generated.
这篇关于Gradle,“sourceCompatibility” vs“targetCompatibility”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!