Sonar Run Analysis getting failed for C/C++ projects on Linux Platform

Hi,

I am trying to analyze my projects(C/C++) on Linux Platform and using Azure Pipeline to integrate SonarQube.

Error:

##[error]ERROR: Error during SonarScanner execution

org.sonar.java.AnalysisException: Please provide compiled classes of your project with sonar.java.binaries property

===============================================================
sonar-project.properties:

sonar.projectKey=RFL_GARD_PRO_ARM
sonar.projectName=RFL_GARD_PRO_ARM
sonar.projectBaseDir=B_ctlr2_pro/appl
sonar.scm.disabled=true
sonar.language=c, cpp
sonar.sourceEncoding=UTF-8
sonar.cfamily.build-wrapper-output=B_ctlr2_pro/sonar-output/
sonar.cfamily.cache.enabled=false

Azure script:

  • task: SonarQubePrepare@4
    inputs:
    SonarQube: ‘SonarCube-CommunityEdition’
    projectKey: ‘RFL_GARD_PRO_ARM’
    projectName: ‘RFL_GARD_PRO_ARM’
    scannerMode: ‘CLI’
    configMode: ‘file’
    displayName: ‘Prepare SonarQube’

  • task: Bash@3
    inputs:
    targetType: ‘inline’
    script: |
    cd B_ctlr2_pro/
    build-wrapper-linux-x86-64 --out-dir sonar-output make

  • task: SonarQubeAnalyze@4

displayName: ‘Analyse SonarQube’

  • task: SonarQubePublish@4
    inputs:
    pollingTimeoutSec: ‘300’

Complete logs attached. Could you please help me to overcome the issue

Thanks,
GopinathSonarQubeAnalyze.txt (15.1 KB)

Hi,

Welcome to the community!

You appear to have a mixed-language project. It seems that analysis is detecting the presence of .java files in your repo but it’s not finding the corresponding compiled .class files.

Why isn’t your sonar.langauge=c,cpp analysis parameter short-circuiting this? Because that long-deprecated parameter was finally removed a few versions ago. Now it’s entirely ignored by analysis.

You have two choices to resolve this:

  • do the Java compile and configure in the location of the .class files
  • exclude .java files (with a pattern like **/*.java) from analysis.

 
HTH,
Ann