Can sonar maven scanner user sonar-project.properties

Can sonar maven scanner user sonar-project.properties

Hi,

Welcome to the community!

No. Those properties are read from your pom instead.

 
Ann

Can I do pull request analysis using sonar maven scanner then?

with sonar scanner I can do

sonar-scanner -X -Dproject.settings=sonar-project.properties
-Dsonar.pullrequest.github.repository=services/comm-smart
-Dsonar.pullrequest.key=${GITHUB_PR_NUMBER}
-Dsonar.pullrequest.branch=${GITHUB_PR_SOURCE_BRANCH}
-Dsonar.pullrequest.base=${GITHUB_PR_TARGET_BRANCH}
-Dsonar.scm.revision=refs/pull/${GITHUB_PR_NUMBER}/head

What is the approach with sonar maven scanner?

Hi,

Yes, of course!

With Maven you can do:

mvn clean build sonar:sonar -Dsonar.pullrequest.key=${GITHUB_PR_NUMBER} -Dsonar.pullrequest.branch=${GITHUB_PR_SOURCE_BRANCH} -Dsonar.pullrequest.base=${GITHUB_PR_TARGET_BRANCH}

Note that I’ve dropped a few parameters that aren’t really helpful here.

 
HTH,
Ann

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