From 72d97b42be0055630898198c7f388639d562d7c0 Mon Sep 17 00:00:00 2001 From: dgelessus <dgelessus@users.noreply.github.com> Date: Thu, 11 Feb 2021 15:44:21 +0100 Subject: [PATCH] Replace convention properties with extension blocks in build.gradle The Gradle documentation says that these convention properties are deprecated and superseded by the java and application extension blocks. Using the convention properties doesn't generate warnings yet, but it can't hurt to switch to the now recommended way. --- build.gradle | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index c760c15..4277c18 100644 --- a/build.gradle +++ b/build.gradle @@ -46,8 +46,10 @@ dependencies { implementation(group: "se.sawano.java", name: "alphanumeric-comparator", version: "1.4.1") } -sourceCompatibility = "1.8" -targetCompatibility = "1.8" +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} tasks.withType(JavaCompile) { options.encoding = SOURCE_ENCODING @@ -71,13 +73,17 @@ processResources { } } -mainClassName = "de.prob2.jupyter.Main" +application { + mainClass = "de.prob2.jupyter.Main" +} +// Workaround for https://github.com/johnrengelman/shadow/issues/609 +mainClassName = application.mainClass.get() final KERNEL_SPEC_OUTPUT_PATH = project.buildDir.toPath().resolve(Paths.get("kernelspec")) task createKernelSpec(type: JavaExec) { dependsOn = [shadowJar] - main = project.mainClassName + mainClass = application.mainClass args = ["createKernelSpec", KERNEL_SPEC_OUTPUT_PATH.toString()] classpath(shadowJar.archiveFile) if (project.hasProperty("probHome")) { -- GitLab