How to deal with multiple .log and .json output files from build process

I am totally new to sonarcloud. I am setting it up for a c++ project. The project is broken up into multiple builds like the following:
path…/mlib/db
path…/mlib/cache
path…/mlib/sync
.
.
.

and each of the paths has its own set of of source/headers and its own pom file. I am to the point in which I have updated the individual pom files to include using the build_wrapper as part of the build process and executing each of the individual build processes do generated the .log and .json output files in my build-wrapper-output directory. However, each one overwrites the previous set that was built. Which makes sense, but my question is, how do I deal with this? I have bunch of different paths that need to build and each one is going to generate its own .log and .json files. I can store them independently so they don’t overwrite each other but I have no idea how to consolidate them for the scanner to produce and overall result.

Hopefully my question made sense, being new to sonarcloud I potentially messed up some of the vocabulary.

Thanks in advance for any help.

Hi @bapserver,

build-wrapper can wrap any process, if you have a parent pom from where you can launch the build you can wrap that build, or you can create a build.sh:

#!/bin/bash

build-1-command
build-2-command
.
.
build-n-command

and then you wrap that:

build-wrapper --out-dir cfamily-output build.sh

Thank you for the help.

I decided to try to wrap the high level mvn command but that turns out to be an issue. Even from the command line:
$ build-wrapper-win-x86-64.exe --out-dir aDir mvn
[SONARSOURCE BUILD-WRAPPER] failed to execute mvn: The system cannot find the file specified.

it complains that mvn can’t be found.

mvn can be found running it by itself:
$ mvn
[INFO] Scanning for projects…
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

and the build wrapper can also be found running it by itself:
$ build-wrapper-win-x86-64.exe --out-dir aDir
build-wrapper, version 6.9 (win-x86-64)
Copyright © 2014-2020 SonarSource SA, info@sonarsource.com

Usage: C:\applications\build-wrapper-win-x86\build-wrapper-win-x86-64.exe --out-dir

Unsure where to go with this, I can’t seem to find the correct magic…

And to further my confusion, if I try to specify the full path of the mvn command:

$ build-wrapper-win-x86-64.exe --out-dir aDir C:/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin/mvn
[SONARSOURCE BUILD-WRAPPER] failed to execute C:/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin/mvn: %1 is not a valid Win32 application.

it tells me it isn’t a valid Win32 application…

makes me feel like I am just missing some basic concept and what I am trying to do is not allowed. I can’t be the first person that has tried this.

Hello @bapserver,

Did you try it with writting the extension(.cmd?). I guess there is two mvn files in that directory:
build-wrapper-win-x86-64.exe --out-dir aDir C:/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin/mvn.cmd

Thanks for responding.

Sorry, I am not understanding what you mean. Could you elaborate a little more?

Ah, I understand what you mean. Let me give that a try.

Thank you. Adding .cmd has allowed me to move forward.

Hi @bapserver,

great, are you facing any other issue or shall we consider this topic as closed?

Thank you for the reply.

This topic is closed. I have another issue that I opened up another thread for.

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