Multi-language scan fails for Java source code while checking for compiled bytecode

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) - SonarQube Version 6.7.5 , SonarScanner version 3.3.0.1492, along with Jenkins
  • what are you trying to achieve - Scanning a project having both Java and C source code
  • what have you tried so far to achieve this - Mentioning it below:

I am scanning a project that has both Java and C source code. While I explicitly provide sonar.language=java or sonar.language=c, the sonar scanner works fine and sonar server reports the issues all good.

But I tried to remove the sonar.language property in my Jenkins configuration just to make sure both Java and C source codes are getting scanned in one go, then I have two problems, one of them surfaces every single time:

  1. The sonarScanner doesn’t find the bytecode/class files for Java code from the target folder, which it actually does when I provide sonar.language=java
    Below is the error thrown:

INFO: PPH: 471 files, 1050867 bytes, 1514 hits, 1985 queries
INFO: Sensor CFamily [cpp] (done) | time=53117ms
INFO: Sensor FindBugs Sensor [findbugs]
WARN: Findbugs needs sources to be compiled. Please build project before executing sonar or check the location of compiled classes to make it possible for Findbugs to analyse your (sub)project (/root/.jenkins/workspace/foo_bar_sa).
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 9:55.505s
INFO: Final Memory: 46M/1327M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Can not execute Findbugs
ERROR: Caused by: One (sub)project contains Java source files that are not compiled (/root/.jenkins/workspace/foo_bar_sa).
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeeded?
ERROR: SonarQube scanner exited with non-zero code: 1
Finished: FAILURE

  1. Unable to locate ‘report-task.txt’ in the workspace.

INFO: PPH: 471 files, 1050867 bytes, 1514 hits, 1985 queries
INFO: Sensor CFamily [cpp] (done) | time=55968ms
INFO: Sensor FindBugs Sensor [findbugs]
INFO: Loading findbugs plugin: /root/.jenkins/workspace/foo_bar_sa/.scannerwork/findbugs/findsecbugs-plugin.jar
INFO: Findbugs output report: /root/.jenkins/workspace/foo_bar_sa/.scannerwork/findbugs-result.xml
WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeeded?
ERROR: SonarQube scanner exited with non-zero code: 137
Finished: FAILURE

Please can someone give me an insight as to what is going on.
My sonar.properties are set like below:

    sonar.host.url=https://10.64.86.125:9000/sonar
    sonar.projectKey=foo_bar
    sonar.projectName=foo_bar
    sonar.projectVersion=${BUILD_TAG}
    sonar.sources=/root/.jenkins/workspace/foo_bar_sa
    sonar.cfamily.build-wrapper-output.bypass=true
    sonar.inclusions=Core/**/*.java,Core/**/*.c
    sonar.exclusions=**/*Test*.java,**/*.sh,**/*.py,**/*.so,**/*.js,**/*.jsp,**/*.xml,**/*.xsl,**/*.cpp,**/*.mk,**/*.dat,**/*.sql,**/*.css,**/*.htm,**/*.html,**/*.m,**/*.web,**/*.php,**/*.inc,**/*.xsd,**/*.phtml,buildScripts/*,conf/*,include/*,tests/*
    sonar.java.binaries=**/target/** 

Thanks,
susenj

It seems to me that both problems are related to FindBugs plugin you have. It’s a community plugin and you can try to ask them for help.