From 740481ab2706ca4525053c046217cc90091c43cd Mon Sep 17 00:00:00 2001 From: dgelessus <dgelessus@users.noreply.github.com> Date: Fri, 12 Feb 2021 15:14:04 +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, 8 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 4cc1061..4c96ee6 100644 --- a/build.gradle +++ b/build.gradle @@ -17,20 +17,22 @@ wrapper { distributionType = Wrapper.DistributionType.ALL } -sourceCompatibility = 7 -targetCompatibility = 7 - repositories { mavenCentral() } -mainClassName = "org.sablecc.sablecc.SableCC" - java { + sourceCompatibility = JavaVersion.VERSION_1_7 + targetCompatibility = JavaVersion.VERSION_1_7 + withSourcesJar() withJavadocJar() } +application { + mainClass = "org.sablecc.sablecc.SableCC" +} + processResources { inputs.property("project.version", project.version) filesMatching("org/sablecc/sablecc/build.properties") { @@ -41,7 +43,7 @@ processResources { jar { manifest { attributes([ - 'Main-Class': mainClassName, + 'Main-Class': application.mainClass.get(), 'Automatic-Module-Name': 'org.sablecc.sablecc', ]) } -- GitLab