How to choose a specified profile to scan code

SonarQube:

  • Community Edition
  • Version 8.7.1 (build 42226

SonarScanner :4.7.0.2747
INFO: Java 11.0.14.1 Eclipse Adoptium (64-bit)
INFO: Windows 11 10.0 amd64

when i run sonar-scanner -Dsonar.projectKey=java-checkstyle -Dsonar.host.url=http://124.223.25.135:9000/ -Dsoner.profile=Checkstyle , i choose a specified profile "Checkstyle " and it logs :

INFO: Load project settings for component key: 'java-checkstyle'
INFO: Load project settings for component key: 'java-checkstyle' (done) | time=434ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=477ms
INFO: Load active rules
INFO: Load active rules (done) | time=8133ms
INFO: Indexing files...
INFO: Project configuration:
INFO: Load project repositories
INFO: Load project repositories (done) | time=477ms
INFO: 127 files indexed
INFO: 113 files ignored because of scm ignore settings
INFO: Quality profile for css: Sonar way
INFO: Quality profile for java: Sonar way
INFO: Quality profile for js: Sonar way
INFO: Quality profile for xml: Sonar way

but it not work,it run default profile"Sonar way", iI want to run my profile “Checkstyle”,I already set a profile named “Checkstyle” in SonarQube,


I need to run many kinds of profiles to check my code such as profile-1,profile-2 , but i don’t know how to set when I run sonar-scanner,dou you have any way to help

soner.profile with er does not exist, and the sonar.profile with ar is deprecated since SonarQube 4.5. Overriding profiles should be set on a per-language basis through the SonarQube UI instead.

1 Like

ohhhh,yes i sew this error ,but I run it correctly sonar-scanner -Dsonar.projectKey=java-checkstyle0329 -Dsonar.host.url=http://124.223.25.135:9000/ -Dsonar.profile=Checkstyle ant it also logs Quality profile for java: FindBugs,that is my default profile.

So sonar.profile is probably not only deprecated but also removed.
This means you need to use the SonarQube website to set the default quality profile of a project or add a project to a quality profile.

Note: If you need to automate this action, you can use the SonarQube webapi /api/qualityprofiles/add_project

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