From d0b6b0f341c297ad06a96508d13597b00dd214a6 Mon Sep 17 00:00:00 2001 From: Kengo TODA Date: Sat, 11 Sep 2021 19:27:25 +0800 Subject: [PATCH] SONAR-15469 Stop using deprecated Gradle API in SonarQube --- build.gradle | 10 +++++----- server/sonar-db-dao/build.gradle | 6 +++--- sonar-application/build.gradle | 8 ++++---- sonar-scanner-protocol/build.gradle | 3 ++- sonar-ws-generator/build.gradle | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 844fb69c1f3..b3b6958a0dd 100644 --- a/build.gradle +++ b/build.gradle @@ -444,12 +444,12 @@ subprojects { } task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' + archiveClassifier = 'sources' from sourceSets.main.allSource } task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' + archiveClassifier = 'javadoc' from javadoc.destinationDir } @@ -461,9 +461,9 @@ subprojects { jacocoTestReport { reports { - xml.enabled true - csv.enabled false - html.enabled false + xml.required = true + csv.required = false + html.required = false } } diff --git a/server/sonar-db-dao/build.gradle b/server/sonar-db-dao/build.gradle index e4f6260f010..cb317501714 100644 --- a/server/sonar-db-dao/build.gradle +++ b/server/sonar-db-dao/build.gradle @@ -50,13 +50,13 @@ test { } task dumpSchema(type:JavaExec) { - main = 'org.sonar.db.dump.DumpSQSchema' + mainClass = 'org.sonar.db.dump.DumpSQSchema' classpath = sourceSets.test.runtimeClasspath } tasks.check.dependsOn dumpSchema task createDB(type:JavaExec) { - main = 'org.sonar.db.createdb.CreateDb' + mainClass = 'org.sonar.db.createdb.CreateDb' classpath = sourceSets.test.runtimeClasspath systemProperty 'orchestrator.configUrl', System.getProperty('orchestrator.configUrl') if (!project.version.endsWith("-SNAPSHOT")) { @@ -65,7 +65,7 @@ task createDB(type:JavaExec) { } task testJar(type: Jar) { - classifier = 'tests' + archiveClassifier = 'tests' from sourceSets.test.output } diff --git a/sonar-application/build.gradle b/sonar-application/build.gradle index 9300bb23e23..70ddc8bb2a3 100644 --- a/sonar-application/build.gradle +++ b/sonar-application/build.gradle @@ -33,8 +33,8 @@ configurations { jar.enabled = false shadowJar { - baseName = 'sonar-application' - classifier = null + archiveBaseName = 'sonar-application' + archiveClassifier = null mergeServiceFiles() manifest { attributes('Main-Class': 'org.sonar.application.App') @@ -229,9 +229,9 @@ zip.doLast { def length = archiveFile.get().asFile.length() if (length < minLength) - throw new GradleException("$archiveName size ($length) too small. Min is $minLength") + throw new GradleException("${archiveFileName.get()} size ($length) too small. Min is $minLength") if (length > maxLength) - throw new GradleException("$distsDir/$archiveName size ($length) too large. Max is $maxLength") + throw new GradleException("${destinationDirectory.get()}/${archiveFileName.get()} size ($length) too large. Max is $maxLength") } assemble.dependsOn zip diff --git a/sonar-scanner-protocol/build.gradle b/sonar-scanner-protocol/build.gradle index f89669bd222..eec132a2f93 100644 --- a/sonar-scanner-protocol/build.gradle +++ b/sonar-scanner-protocol/build.gradle @@ -27,9 +27,10 @@ task fatJar(type: Jar) { manifest { attributes 'Main-Class': 'org.sonar.scanner.protocol.viewer.ScannerReportViewerApp' } - baseName = project.name + '-all' + archiveBaseName = project.name + '-all' from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } with jar + duplicatesStrategy = DuplicatesStrategy.EXCLUDE } build.dependsOn fatJar diff --git a/sonar-ws-generator/build.gradle b/sonar-ws-generator/build.gradle index e872e414c79..902dcf153d0 100644 --- a/sonar-ws-generator/build.gradle +++ b/sonar-ws-generator/build.gradle @@ -22,7 +22,7 @@ task fatJar(type: Jar) { manifest { attributes 'Main-Class': 'org.sonarqube.wsgenerator.Generator' } - classifier = 'jar-with-dependencies' + archiveClassifier = 'jar-with-dependencies' from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } with jar } -- 2.39.5