Error during SonarScanner execution (CFamily) Java Exception

Must-share information:

  • which versions are you using
    • SonarQube Enterprise Edition Version 8.4.1 (build 35646)
    • Scanner
    • Build Wrapper downloaded directly from our SonarQube server at {SonarQube URL}/static/cpp/, build-wrapper, version 6.11 (linux-x86)
    • Plugins:
      • SonarCSS (cssfamily)
      • Svn (scmsvn)
      • SonarPLSQL (plsql)
      • SonarScala (sonarscala)
      • C# Code Quality and Security (csharp)
      • Vulnerability Analysis (security)
      • Java Code Quality and Security (java)
      • SonarHTML (web)
      • SonarFlex (flex)
      • SonarXML (xml)
      • SonarTS (typescript)
      • VB.NET Code Quality and Security (vbnet)
      • SonarSwift (swift)
      • CFamily Code Quality and Security (cpp)
      • Python Code Quality and Security (python)
      • JaCoCo (jacoco)
      • RPG Code Quality (rpg)
      • SonarGo (go)
      • SonarKotlin (kotlin)
      • SonarPLI (pli)
      • SonarTSQL (tsql)
      • SonarVB6 (vb)
      • SonarApex (sonarapex)
      • SonarJS (javascript)
      • SonarRuby (ruby)
      • Vulnerability Rules for C# (securitycsharpfrontend)
      • Vulnerability Rules for Java (securityjavafrontend)
      • License for SonarLint (license)
      • COBOL Code Quality (cobol)
      • Vulnerability Rules for Python (securitypythonfrontend)
      • Git (scmgit)
      • PHP Code Quality and Security (php)
      • SonarABAP (abap)
      • Vulnerability Rules for PHP (securityphpfrontend)
    • and any relevant extension
      • Running in a container
      • CentOS Linux release 8.2.2004
      • Java 11 OpenJDK Runtime Environment 18.9 (build 11.0.8+10-LTS)
      • cpack version 3.11.4
      • gcc version 8.3.1 20191121 (Red Hat 8.3.1-5)
  • what are you trying to achieve
    • I am trying to implement the build wrapper and scanner in an existing project that is a template project that developers will be able to fork and begin the process of making an application that will integrate with our CICD pipeline.
  • what have you tried so far to achieve this
    • The existing project has a that will, depending on if BUILD_RPM is set to true, compile the project as an rpm using CPack or, if not, just a normal build. If BUILD_RPM is set to false, the build wrapper and build pass, as well as the scanning of the build wrapper output. The results are viewable in the WEBUI, success! If BUILD_RPM is set to true, however, the build and wrapper pass but the scan of the build wrapper output fails with a java error. The only difference between the two is that the former calls ‘build-wrapper-linux-x86-64 --out-dir build_wrapper_output_directory make’ while the latter calls ‘build-wrapper-linux-x86-64 --out-dir build_wrapper_output_directory make package’. Make package relies on CPack to create the rpm. Are there any known issues with using Build Wrapper with CPack?

I have saved the debug output of sonar-scanner in the failed case.

Hello @christopher.t.boyer,

I sent you a private message where you can share the output.


Thanks for your help @Abbas_Sabra. The failure during scanning was caused by building and then copying the build directory and scanning in a different absolute/path. Our reasons for doing this are because building and scanning happen in different stages and are handled by different containers. Ultimately, recreating the original absolute/path of the build artifacts did the trick.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.