Add project to SonarQube

I am trying to add a project(gerrit repo) to our staging SonarQube instance.
Here is what I have done so far, I create a new project and name it as “MJE” from the
Administration->Projects->Management, and click the Create project button on the far right side.

However, the MJE I created is just an empty project, I would like to bind it to the gerrit clone address. So whenever there is a run on this project “MJE”, all rules I will later apply to will take effective.

Can someone tell me how I can connect the MJE to its corresponding gerrit clone address?

Thank you

@Colin_SonarSource @Rebse , Could you help me take a look at this problem. It is a bit urgent.

Thank you a lot in advance for your reply.

Hi,

how do you run your builds, Jenkins ?

Gilbert

yes, we run the build on jenkins, when the jenkins gets triggered, the project will gets scanned by the SonarQube.

Hi,

regarding your screenshot, i assume those are Java projects.
Usually Java projects are built with Maven, means you should use the SonarScanner for Maven

But your sonar.projectKey naming is not maven like.
Normally projectKey is groupid:artifactid, see analysis parameters
Also
no need to manually create a Sonarqube project, your Jenkins user should have sufficient rights
to create a Sonarqube project, means the project is created with the first build
i guess your projects should be private by default !?

WRT git server (Geritt in your case) <-> Jenkins interaction.
Your git server has configured a global hook, calling Jenkins for every git push event.
Don’t know how this works with Geritt - we use Azure Devops -but that should be possible.

In Jenkins every job / pipeline that has the git repo URL configured will start automatically,
i recommend to use Jenkins multibranch pipelines.
A pipeline will usually have stages like git checkout, build incl. tests, Sonarqube scan,
check Sonarqube quality gate, publish to Artifactory/Sonatype Nexus, deploy.

Gilbert