# How set file exclusions in SonarLint in Eclipse 2021?

**URL:** <https://community.sonarsource.com/t/how-set-file-exclusions-in-sonarlint-in-eclipse-2021/55083>\
**Category:** Eclipse\
**Tags:** eclipse\
**Created:** [December 16, 2021, 7:23am UTC](https://community.sonarsource.com/t/how-set-file-exclusions-in-sonarlint-in-eclipse-2021/55083 "2021-12-16T07:23:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![a\_subscriber](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@a\_subscriber](https://community.sonarsource.com/u/a_subscriber)\
**Post date:** [December 16, 2021, 7:23am UTC](https://community.sonarsource.com/t/how-set-file-exclusions-in-sonarlint-in-eclipse-2021/55083/1 "2021-12-16T07:23:03Z")

</div>

Eclipse 2021

Plugin SonarLint

In Jenkins’s job I has the next **SonarQube Scanner** I has the next settings:

```auto

sonar.exclusions= **/generated-sources/** , **/src/test/** , **/*Header.java,./.svn,** /*.css, **/*.html,** /target/ **/*.*,** /Modulation.java

```

Nice. It’s work fine.

Now I want to set this settings in **Eclipse 2021** , in plugin **SonarLint**.

So in Eclipse, _Window-Preferences-\>SonarLint-\>File Exclusions_ and set this:

`sonar.exclusions= **/generated-sources/** , **/src/test/** , **/*Header.java,./.svn,** /*.css, **/*.html,** /target/ **/*.*,** /Modulation.java`

 ![1](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/a/2/a2ca23639999b1658b0a8e2d7c2b90c9dd8f9d42.png)

 ![2](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/5/c/5c89e57ce2595619814e2eb27f79a64cd52d48d5.png)

 ![3](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/8/4/840639257caa90854d2496f36af78875d5eb0030.png)

Is it correct settings for exclusions?

P.S.  
Also in Jenkins’s job has the next settings for SonarQube Scanner:

```auto
sonar.issue.ignore.multicriteria.e1.ruleKey=java:S115
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*Type.java

sonar.java.source=1.8

```

What about it? How I can set it in plugin SonarLint?

---

<div class="post-metadata">

**Author:** ![Damien\_Urruty](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/damien_urruty/32/43383_2.png) [@Damien\_Urruty](https://community.sonarsource.com/u/Damien_Urruty)\
**Post date:** [December 20, 2021, 8:57am UTC](https://community.sonarsource.com/t/how-set-file-exclusions-in-sonarlint-in-eclipse-2021/55083/2 "2021-12-20T08:57:22Z")

</div>

Hello @a_subscriber,

You should not add `sonar.exclusions=` at the beginning, and I recommend you use a `New...` entry for each item in your exclusions list.

Let me know if this helps  
Damien

---

<div class="post-metadata">

**Author:** ![Damien\_Urruty](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/damien_urruty/32/43383_2.png) [@Damien\_Urruty](https://community.sonarsource.com/u/Damien_Urruty)\
**Post date:** [December 20, 2021, 9:03am UTC](https://community.sonarsource.com/t/how-set-file-exclusions-in-sonarlint-in-eclipse-2021/55083/3 "2021-12-20T09:03:40Z")

</div>

The `sonar.java.source=1.8` property should be automatically set from the version in use in your project.

For the other properties you mention, there is a _Analyzer Properties_ menu near _File exclusions_. You could add the key and the value of each property there

---

<div class="post-metadata">

**Author:** ![a\_subscriber](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@a\_subscriber](https://community.sonarsource.com/u/a_subscriber)\
**Post date:** [December 20, 2021, 10:41am UTC](https://community.sonarsource.com/t/how-set-file-exclusions-in-sonarlint-in-eclipse-2021/55083/4 "2021-12-20T10:41:07Z")

</div>

I set this for SonarLint in Eclipse:

 ![sonarLint_1](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/b/f/bfec80c8ca925ca6bded9eb4c450f728ae8398cd.png)  
and this  
 ![SonarLint_2](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/e/0/e035a0bf9ce167d1b67d5eb0dbe4f5ccbd5b0db4.png)

Is this a correct settings?

---

<div class="post-metadata">

**Author:** ![Damien\_Urruty](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/damien_urruty/32/43383_2.png) [@Damien\_Urruty](https://community.sonarsource.com/u/Damien_Urruty)\
**Post date:** [December 20, 2021, 1:03pm UTC](https://community.sonarsource.com/t/how-set-file-exclusions-in-sonarlint-in-eclipse-2021/55083/5 "2021-12-20T13:03:24Z")

</div>

It looks ok to me yes.

But now I realize that this might not be the best way. If you are using SonarQube you should define those properties at the project level directly in the UI. This would avoid duplicating the properties both when calling the scanner and in SonarLint.

In SonarQube, you can go to your project’s page, then Project Settings \> General Settings \> Analysis Scope. These settings will then automatically apply for each scan (no need to configure them in Jenkins).

Now in SonarLint there is a functionality to bind a project to the server. This will automatically apply the settings (and quality profiles) you defined in SonarQube. You can have a look at [this page](https://github.com/SonarSource/sonarlint-eclipse/wiki/Connected-Mode) to see how to connect SonarLint to your SonarQube instance. You could then get rid of all the settings on the SonarLint side.

Hope this helps,  
Damien

---

<div class="post-metadata">

**Author:** ![a\_subscriber](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@a\_subscriber](https://community.sonarsource.com/u/a_subscriber)\
**Post date:** [December 20, 2021, 6:17pm UTC](https://community.sonarsource.com/t/how-set-file-exclusions-in-sonarlint-in-eclipse-2021/55083/6 "2021-12-20T18:17:07Z")

</div>

SonarQube’s rules better set on UI (not in Jenkins’s job). As result you not need to duplicate rules in Jenkins’s job and Eclipse (SonarLint plugin).

Right?

---

<div class="post-metadata">

**Author:** ![Damien\_Urruty](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/damien_urruty/32/43383_2.png) [@Damien\_Urruty](https://community.sonarsource.com/u/Damien_Urruty)\
**Post date:** [December 21, 2021, 8:47am UTC](https://community.sonarsource.com/t/how-set-file-exclusions-in-sonarlint-in-eclipse-2021/55083/7 "2021-12-21T08:47:51Z")

</div>

Yes it is better to configure active rules through the Quality Profile In SonarQube UI. If the rules activated in the default Quality Profile (Sonar Way) do not suit you, you can extend or copy the QP and customize it. More on that [here](https://docs.sonarqube.org/latest/instance-administration/quality-profiles/).

And if you bind your project in SonarLint, then it will automatically apply the QP that is assigned to your project in SonarQube. So no duplication, active rules are configured at a single place, in SonarQube

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [December 28, 2021, 8:47am UTC](https://community.sonarsource.com/t/how-set-file-exclusions-in-sonarlint-in-eclipse-2021/55083/8 "2021-12-28T08:47:55Z")

</div>

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