Discussion:
[sonar-user] Applying project exclusions when running from eclipse
Keppler Michael (ETAS/ESW4)
2014-11-06 11:44:20 UTC
Permalink
Hi everyone,

Our server based scans are working fine for a multi module project and use the defined multi criteria issue exclusions (e.g. to silence a certain check on a certain auto generated file).

However, if I run the scan in Eclipse (via Sonar Eclipse plugin) for just one Eclipse Java project (which is a module of the above multi module project), all my excluded issues come up again. Is this a limitation of the Eclipse plugin as such? Or is the problem related to scanning a single Eclipse Java project, which is only a component of the Server based multi module project?

What else might I need to look at?

Ciao, Michael
Julien HENRY
2014-11-06 12:54:00 UTC
Permalink
Hi Michael,

Could you please share what are your exclusion patterns? Maybe you have
written them using absolute path?

++

Julien

2014-11-06 12:44 GMT+01:00 Keppler Michael (ETAS/ESW4) <
Post by Keppler Michael (ETAS/ESW4)
Hi everyone,
Our server based scans are working fine for a multi module project and use
the defined multi criteria issue exclusions (e.g. to silence a certain
check on a certain auto generated file).
However, if I run the scan in Eclipse (via Sonar Eclipse plugin) for just
one Eclipse Java project (which is a module of the above multi module
project), all my excluded issues come up again. Is this a limitation of the
Eclipse plugin as such? Or is the problem related to scanning a single
Eclipse Java project, which is only a component of the Server based multi
module project?
What else might I need to look at?
Ciao, Michael
Keppler Michael (ETAS/ESW4)
2014-11-06 16:47:08 UTC
Permalink
Hi Julien,

while writing down an example, I found that it is not related to issue exclusions at all. We use <sonar.exclusions> in the parent POM (which is inherited by all modules). And the discrepancies only happen on files, which have been excluded this way. So the server scan completely ignores a file listed there, the Eclipse based scan does not.

I assume the Eclipse scan doesn’t look at these POM settings at all, right? If so, I would try re-defining the same exclusions in the web UI (which I totally don’t like, as that is not under version control).

Ciao, Michael


Von: Julien HENRY [mailto:***@sonarsource.com]
Gesendet: Donnerstag, 6. November 2014 13:54
An: ***@sonar.codehaus.org
Betreff: Re: [sonar-user] Applying project exclusions when running from eclipse

Hi Michael,
Could you please share what are your exclusion patterns? Maybe you have written them using absolute path?

++
Julien

2014-11-06 12:44 GMT+01:00 Keppler Michael (ETAS/ESW4) <***@etas.com<mailto:***@etas.com>>:
Hi everyone,

Our server based scans are working fine for a multi module project and use the defined multi criteria issue exclusions (e.g. to silence a certain check on a certain auto generated file).

However, if I run the scan in Eclipse (via Sonar Eclipse plugin) for just one Eclipse Java project (which is a module of the above multi module project), all my excluded issues come up again. Is this a limitation of the Eclipse plugin as such? Or is the problem related to scanning a single Eclipse Java project, which is only a component of the Server based multi module project?

What else might I need to look at?

Ciao, Michael
Julien HENRY
2014-11-06 17:36:32 UTC
Permalink
2014-11-06 17:47 GMT+01:00 Keppler Michael (ETAS/ESW4) <
Post by Keppler Michael (ETAS/ESW4)
I assume the Eclipse scan doesn’t look at these POM settings at all, right?
It should if you have the m2e connector installed. Please check project
settings in SonarQube section to see if settings was "imported". You may
have to do Maven -> Update Project for synchro to occurs.
Paul Reeves
2014-11-19 15:01:51 UTC
Permalink
Hi

I'm also seeing an issue where my exclusions are not being picked up in the
Sonarqube eclipse plugin from my Maven Pom

Im using

Eclispe luna 4.4.1
SonarQube m2e Connector 3.4.0.20140404-0949-RELEASE

In the properties section of my pom I have

<sonar.projectKey>com.mycompany:some-service:Java</sonar.projectKey>
<sonar.projectName>My Project</sonar.projectName>
<sonar.exclusions>**/foobar/**.java</sonar.exclusions>

When I run mvn sonar:sonar I get



[INFO] [14:49:29.658] Source paths: src/main/java
[INFO] [14:49:29.658] Test paths: src/test/java
[INFO] [14:49:29.658] Binary dirs: target/classes
[INFO] [14:49:29.658] Source encoding: UTF-8, default locale: en_US
[INFO] [14:49:29.658] Index files
[INFO] [14:49:29.660] Excluded sources:
[INFO] [14:49:29.660] **/foobar/**.java
[INFO] [14:49:29.777] 24 files indexed
[INFO] [14:49:29.894] Quality profile for java: My Profile

However, running using the sonarqube plugin ) in the eclipse sonarqube
console the output i get is

14:54:13.642 INFO - Source paths: src/main/java, target/jaxws/wsimport/java
14:54:13.642 INFO - Test paths: src/test/java
14:54:13.642 INFO - Binary dirs: target/classes
14:54:13.642 INFO - Source encoding: UTF-8, default locale: en_US
14:54:13.642 INFO - Index files

If I then got to Project->Properties->SonarQube->Preview Analysis Properties
and click New to create a new property and set it to sonar.exclusions with a
value of **/foobar/**.java and re-run SonarQube->Analyze

I get

14:59:12.385 INFO - Source paths: src/main/java, target/jaxws/wsimport/java
14:59:12.386 INFO - Test paths: src/test/java
14:59:12.386 INFO - Binary dirs: target/classes
14:59:12.386 INFO - Source encoding: UTF-8, default locale: en_US
14:59:12.386 INFO - Index files
14:59:12.386 INFO - Excluded sources:
14:59:12.386 INFO - **/foobar/**.java

Which shows the excluded sources and ignores classes in the foo package.

Should this plugin pickup

<sonar.exclusions>**/foobar/**.java</sonar.exclusions>

Because i cannot get it to do it. updated maven project, refreshed, closed
project, restarted etc but it still wont pick it up. If it could that would
be great..

Paul












--
View this message in context: http://sonarqube.15.x6.nabble.com/Applying-project-exclusions-when-running-from-eclipse-tp5029882p5030219.html
Sent from the SonarQube Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Loading...