SonarScanner complains about build_wrapper_output_directory

I have this:
withSonarQubeEnv(SONAR_INSTANCE_NAME)
{
bat “${sqScannerMsBuildHome}\SonarScanner.MSBuild.exe begin /k:${projectSonarKey} /n:${projectSonarName} /v:1.0 /d:sonar.host.url=${sonarQubeUrl} /d:sonar.login=${login} /d:sonar.cfamily.build-wrapper-output=build_wrapper_output_directory”
bat “${MSBUILD} ${SOLUTION_FILE} /p:Configuration=Release /p:Platform=“Win32"”
bat “”${sonarScanner}” end /d:sonar.login=${login}"
}

I created build_wrapper_output_directory directory anticipating generated json file. Instead i got exception:
java.lang.IllegalStateException: java.nio.file.NoSuchFileException: D:\apps\jenkins\324b2421\workspace\CBPrimeCppBuild\build_wrapper_output_directory\build-wrapper-dump.json

There is a build-wrapper output directory parameter. What is wrong with my definition?

Hi @cjasniew ,

See Solution with Mix of C# and C++. I don’t see your script running the build-wrapper, which is what you need to combine with your ${MSBUILD} command. You need to combine build-wrapper with MSBUILD, then run the END step of SonarScanner for MSBuild.

Like that?
bat "build-wrapper-win-x86-64.exe --out-dir build_wrapper_output_directory ${MSBUILD} ${SOLUTION_FILE} /p:Configuration=Release /p:Platform=“Win32"”

1 Like

@cjasniew : yes that looks correct:

withSonarQubeEnv(SONAR_INSTANCE_NAME)
{
    bat “${sqScannerMsBuildHome}\SonarScanner.MSBuild.exe begin /k:${projectSonarKey} /n:${projectSonarName} /v:1.0 /d:sonar.host.url=${sonarQubeUrl} /d:sonar.login=${login} /d:sonar.cfamily.build-wrapper-output=build_wrapper_output_directory”
    bat "build-wrapper-win-x86-64.exe --out-dir build_wrapper_output_directory ${MSBUILD} ${SOLUTION_FILE} /p:Configuration=Release /p:Platform=“Win32"”
    bat “”${sonarScanner}” end /d:sonar.login=${login}"
}

What to do about build_wrapper_output_directory?
Will be it created automatically or I have to create it before calling?

Yes, it will be created automatically by the build-wrapper command. You don’t need to create it before calling it.

What is wrong with below command. I think i passed all needed params.
D:\apps\jenkins\324b2421\workspace\CBPrimeCppBuild>"“D:\apps\sonar-scanner-msbuild\build-wrapper-win-x86\build-wrapper-win-x86-64.exe”" --out-dir build_wrapper_output_directory ““D:\apps\visualstudio\16.0\MSBuild\Current\Bin\msbuild.exe”” CBPrime_Repository_AsOf24Oct2014/convertibles/CBPrime_All.sln /p:Configuration=Release /p:Platform=“Win32”
build-wrapper, version 6.3 (win-x86-64)
Copyright (C) 2014-2019 SonarSource SA, info@sonarsource.com

Usage: D:\apps\sonar-scanner-msbuild\build-wrapper-win-x86\build-wrapper-win-x86-64.exe --out-dir

@cjasniew : can you post your logs? What error are you getting?

I got usage line but i pass all params. Look at previous message

There are some strange double-quotes there, is that correct?

I removed quotas and it works fine.

1 Like

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