Apply custom sonar rules to SonarLint

Hi experts,

My configuration is:
Eclipse IDE for Java Developers (4.11.0)
SonarLint for Eclipse(
Apache Maven 3.6.1
Java: 11.0.5

We plan to use SonarLint to detect and fix quality issues of our project. Our project is a multi-module Maven project, called alpha, and the IDE we use is Eclipse/IntelliJ.

We have created a plugin which includes a bunch of Sonar Java custom rules for alpha, called alpha-custom-java-rules, and right now I would like to apply these rules to SonarLint.

What I have done so far is that I have activated SonarLint support via changing pom.xml of alpha, and have used

-> mvn clean install -U

to do the whole compilation and packaging work.

		       <pluginName>Alpha Custom Java Rules</pluginName>

The following screenshot is the Sonarlint configuration UI in Eclipse

My question is: In Eclipse/IntelliJ, how can I verify if these custom rules take effect in SonarLint?

Your reply will be highly appreciated.


Custom Java rules should be executed by SonarLint if you use SonarLint in connected mode with a SonarQube server that has your alpha-custom-java-rules plugin installed, and the custom rules don’t rely upon a custom sensor.

Hope this helps!


Thank you a lot for your answer.

Via checking the test connection from Eclipse, I have successfully bind the project alpha to the SonarQube server where the alpha-custom-java-rules installed. I think, at this point, I have established a connection between SonarQube server and SonarLint.

However, when I run the SonarLint to analyze a changed file, the rules defined in alpha-custom-java-rules haven’t applied

I also searched a rule defined in alpha-custom-java-rules

It says “when a project is connected to a SonarQube/SonarCloud server, configuration from the server applies”
but I didn’t manage to find any rules from the “`alpha-custom-java-rules” plugin.

Indeed, in connected mode, all analysis settings come from the project’s configuration on the server side.

This means that you will want to check the following points:

  • your alpha project exists on the server
  • the Quality Profile associated to the project on the server has the custom rule(s) enabled
  • relevant issues are found by the custom rule(s) on the server, if the project has already been analyzed
  • your Eclipse project is bound to the right project from the server

What can be misleading is that the “Rules Configuration” panel in Eclipse only shows rules available in the analyzers embedded in your version of SonarLint, and does not reflect server side settings.

1 Like

Hi, I have a problem similar to this topic but wanting to import plugin rules instead of custom rules.
I have 15 rules in a quality profile established on the SonarQube server, 12 being from the repository that SonarLint does find, but the other 3 from plugins that do not appear in Rule Configurations.
I have not understood this answer very well. Could you elaborate a bit more on the answer of why they do not appear or if I can put them in the configuration?
(I’m using Eclipse too)

Thanks for your attention and greetings.

Hello, thank you for your question.

I suggest that you open a new thread with as much information about your setup as possible - e.g the version of your SonarQube server and the list of plugins installed on it.

Please note that the “Rules Configuration” pane in Eclipse only reflects the local settings and not the ones that come from the server.