How to make sonar-scanner just download plug-ins


we are using SonarQube Developer Edition version 9.9.1 (build 69595) and sonar-scanner-

I noticed that sonar-scanner downloads a lot of plug-ins when running the first analysis. We are working in a devcontainer, so I would like to move this step of downloading the plug-ins to the build stage of the container. How can I achieve that?

My closest approach by now is this:

export SONAR_HOST_URL=...
export SONAR_TOKEN=...
/opt/sonar-scanner- -X | tee >(grep "You must define the following mandatory properties for 'Unknown': sonar.projectKey")

Like this sonar-scanner will download the plug-ins and then emit an error, because the project key is not set. I artificially fix the exit code of the command by grepping for the expected error message. It works, but it is kind of dirty.
Is there a better approach?


Welcome to the community!

You might be interested in the approach discussed here:


Thanks, Ann, I joined in on this thread.