INNER CODE UNIT · Java
apply
scalar-labs/scalardb · buildSrc/src/main/java/com/scalar/db/JdkConfigurationPlugin.java:64
public void apply(@NotNull Project project) {
parseIntegrationTestInputProperties(project);
validateInput();
configureJdkForAllJavaTasks(project);
configureJdkForIntegrationTestTasks(project);
}
private void configureJdkForAllJavaTasks(Project project) {
JavaPluginExtension javaPlugin = project.getExtensions().getByType(JavaPluginExtension.class);
if (javaVersion == null) {
// When the JDK is not set explicitly with the `javaVersion` property, this ensures the
// project is compiled to Java 8 bytecode
javaPlugin.setSourceCompatibility(JavaLanguageVersion.of(8));
javaPlugin.setTargetCompatibility(JavaLanguageVersion.of(8));
} else {
javaPlugin.getToolchain().getLanguageVersion().set(javaVersion);
logger.debug("Configure to use JDK {} for Java tasks", javaVersion);
}