Compile and scan with another JDK version

Most of our applications are still written in Java 8 and we use Gradle for compilation, analysis, etc.

To be able to do a sonar analysis, gradle must run with Java 11. To do this, we use this plugin Gradle - Plugin: org.sonarqube (version 4.4.1.3373)

It’s working very well except for certain projects which have code not compatible with Java 11. When we execute this command (gradle sonarqube), it first builds the application.

how to do a scan without buiding?

1 Like

OK thanks,

Concretely, what should I do?

Here my gradle file :

buildscript {
  repositories {
    maven {
      url = "http://w2016-nexus.fedris.be:8089/nexus/repository/maven-central/"
    }
    maven {
      url = "http://w2016-nexus.fedris.be:8089/nexus/repository/plugin-gradle/"
    }
  }
  dependencies {
    classpath("gradle.plugin.io.github.http-builder-ng:http-plugin:0.1.1")
    classpath("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.4.1.3373")
    classpath("org.cyclonedx:cyclonedx-gradle-plugin:1.7.4")
  }
}

apply plugin: 'org.sonarqube'

apply from: System.getenv('GRADLE_UTILS') + '\\fedris\\jenkins.gradle'
apply from: System.getenv('GRADLE_UTILS') + '\\fedris\\deployment.gradle'
apply from: System.getenv('GRADLE_UTILS') + '\\fedris\\fedriscommon.gradle'
apply from: System.getenv('GRADLE_UTILS') + '\\fedris\\version.gradle'

subprojects {
  apply plugin: 'java'

  dependencies {
    testCompile group: 'org.springframework', name: 'spring-test', version: "$springVersion"
    testCompile group: 'junit', name: 'junit', version: "4.+"
  }
}

jar {
  enabled = false
}

sonarqube {
  properties {
    property "sonar.projectKey", "COR_letters_AYw1ioI6Ywl1aHNnSC6d"
  }
}

Thanks

having not received an answer, I am relaunching my question