From: Matteo Mara Date: Wed, 21 Dec 2022 09:30:51 +0000 (+0100) Subject: SONAR-17566 Drop jdk11 support for running the SonarQube server X-Git-Tag: 9.9.0.65466~135 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4a1916621a67c1bbf45f41118787288a696a9a57;p=sonarqube.git SONAR-17566 Drop jdk11 support for running the SonarQube server --- diff --git a/.cirrus.yml b/.cirrus.yml index 7d78f3a435e..ede2a06553e 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -303,32 +303,6 @@ qa_task: - ./private/cirrus/cirrus-qa.sh postgres <<: *DEFAULT_ARTIFACTS_TEMPLATE -qa_java11_task: - <<: *DEFAULT_TEMPLATE - <<: *BUILD_DEPENDANT_TASK_TEMPLATE - <<: *GRADLE_CACHE_TEMPLATE - <<: *JAR_CACHE_TEMPLATE - gke_container: - dockerfile: private/docker/Dockerfile-build-java11 - builder_image_project: sonarqube-team - builder_image_name: family/docker-builder - cluster_name: cirrus-ci-cluster - zone: us-central1-a - namespace: default - cpu: 2 - memory: 6Gb - additional_containers: - - <<: *POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE - env: - matrix: - - QA_CATEGORY: Cat1 - - QA_CATEGORY: CommunityEditionWithPlugins - - QA_CATEGORY: ComputeEngine - - QA_CATEGORY: Upgrade - script: - - ./private/cirrus/cirrus-qa.sh postgres - <<: *DEFAULT_ARTIFACTS_TEMPLATE - task: #bitbucket <<: *DEFAULT_TEMPLATE <<: *BUILD_DEPENDANT_TASK_TEMPLATE diff --git a/build.gradle b/build.gradle index 2f61bf46e00..1dd8134b929 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,7 @@ import groovy.json.JsonOutput +import static org.gradle.api.JavaVersion.VERSION_17 + plugins { // Ordered alphabetically id 'com.github.hierynomus.license' version '0.16.1' @@ -13,8 +15,8 @@ plugins { id 'org.sonarqube' version '3.5.0.2730' } -if (!JavaVersion.current().java11Compatible) { - throw new GradleException("JDK 11+ is required to perform this build. It's currently " + System.getProperty("java.home") + ".") +if (!JavaVersion.current().isCompatibleWith(VERSION_17)) { + throw new GradleException("JDK 17+ is required to perform this build. It's currently " + System.getProperty("java.home") + ".") } /** @@ -146,9 +148,6 @@ subprojects { // do not deploy to Artifactory by default artifactoryPublish.skip = true - // Produce Java 11 bytecode while making sure the code does not use any APIs from Java 17 - compileJava.options.release = 11 - compileJava.options.encoding = "UTF-8" compileTestJava.options.encoding = "UTF-8" diff --git a/plugins/sonar-xoo-plugin/build.gradle b/plugins/sonar-xoo-plugin/build.gradle index 95e4dc3acc4..62af71aa40c 100644 --- a/plugins/sonar-xoo-plugin/build.gradle +++ b/plugins/sonar-xoo-plugin/build.gradle @@ -33,6 +33,11 @@ jar { artifactoryPublish.skip = false +// Produce Java 11 bytecode while making sure the code does not use any APIs from Java 17 +tasks.withType(JavaCompile) { + options.release = 11 +} + publishing { publications { mavenJava(MavenPublication) { diff --git a/sonar-core/build.gradle b/sonar-core/build.gradle index cd1c8250cf7..ded22c46c6f 100644 --- a/sonar-core/build.gradle +++ b/sonar-core/build.gradle @@ -37,6 +37,11 @@ dependencies { testCompileOnly 'com.google.code.findbugs:jsr305' } +// Produce Java 11 bytecode while making sure the code does not use any APIs from Java 17 +tasks.withType(JavaCompile) { + options.release = 11 +} + // Used by sonar-db-core to run DB Unit Tests artifactoryPublish.skip = false publishing { diff --git a/sonar-duplications/build.gradle b/sonar-duplications/build.gradle index d3c65d720b2..351b5c922f7 100644 --- a/sonar-duplications/build.gradle +++ b/sonar-duplications/build.gradle @@ -19,3 +19,8 @@ dependencies { testImplementation 'org.hamcrest:hamcrest-core' testImplementation 'org.mockito:mockito-core' } + +// Produce Java 11 bytecode while making sure the code does not use any APIs from Java 17 +tasks.withType(JavaCompile) { + options.release = 11 +} diff --git a/sonar-markdown/build.gradle b/sonar-markdown/build.gradle index 714a4651345..7bd7025a437 100644 --- a/sonar-markdown/build.gradle +++ b/sonar-markdown/build.gradle @@ -17,6 +17,11 @@ dependencies { artifactoryPublish.skip = false +// Produce Java 11 bytecode while making sure the code does not use any APIs from Java 17 +tasks.withType(JavaCompile) { + options.release = 11 +} + publishing { publications { mavenJava(MavenPublication) { diff --git a/sonar-plugin-api-impl/build.gradle b/sonar-plugin-api-impl/build.gradle index 3b9fde8eced..51480338d9d 100644 --- a/sonar-plugin-api-impl/build.gradle +++ b/sonar-plugin-api-impl/build.gradle @@ -34,6 +34,11 @@ processResources { artifactoryPublish.skip = false +// Produce Java 11 bytecode while making sure the code does not use any APIs from Java 17 +tasks.withType(JavaCompile) { + options.release = 11 +} + publishing { publications { mavenJava(MavenPublication) { diff --git a/sonar-scanner-engine/build.gradle b/sonar-scanner-engine/build.gradle index f25a70b6519..a494664c442 100644 --- a/sonar-scanner-engine/build.gradle +++ b/sonar-scanner-engine/build.gradle @@ -66,6 +66,11 @@ license { artifactoryPublish.skip = false +// Produce Java 11 bytecode while making sure the code does not use any APIs from Java 17 +tasks.withType(JavaCompile) { + options.release = 11 +} + // Used by core plugins publishing { publications { diff --git a/sonar-scanner-protocol/build.gradle b/sonar-scanner-protocol/build.gradle index 3e45afc6882..2413f3da74f 100644 --- a/sonar-scanner-protocol/build.gradle +++ b/sonar-scanner-protocol/build.gradle @@ -33,6 +33,11 @@ task fatJar(type: Jar) { build.dependsOn fatJar +// Produce Java 11 bytecode while making sure the code does not use any APIs from Java 17 +tasks.withType(JavaCompile) { + options.release = 11 +} + // Used by sonar-db-core to run DB Unit Tests artifactoryPublish.skip = false publishing { diff --git a/sonar-testing-harness/build.gradle b/sonar-testing-harness/build.gradle index 7826c3bdba9..6c2d5ad32bf 100644 --- a/sonar-testing-harness/build.gradle +++ b/sonar-testing-harness/build.gradle @@ -19,6 +19,11 @@ dependencies { compileOnlyApi 'com.google.code.findbugs:jsr305' } +// Produce Java 11 bytecode while making sure the code does not use any APIs from Java 17 +tasks.withType(JavaCompile) { + options.release = 11 +} + artifactoryPublish.skip = false publishing { publications { diff --git a/sonar-ws/build.gradle b/sonar-ws/build.gradle index 01338797055..d6c59dfce1b 100644 --- a/sonar-ws/build.gradle +++ b/sonar-ws/build.gradle @@ -33,6 +33,11 @@ dependencies { artifactoryPublish.skip = false +// Produce Java 11 bytecode while making sure the code does not use any APIs from Java 17 +tasks.withType(JavaCompile) { + options.release = 11 +} + publishing { publications { mavenJava(MavenPublication) {