Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-777

REGRESSION : cannot exclude files from check and bug detection. The new source exclusion feature doesn't work neither

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 1.8
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      All

      Description

      I am using maven 2.0.9
      I have a project that contains an antlr generated grammar parser (that is put in source control as their is no good maven antlr plugin) that is put in a src/java/antlr specific folder or a maven project.
      In my previous deployed version, Sonar 1.6, it was excluded. Since I upgraded to 1.8, it is now included, and is 80% of my rule violations, which is too much noise to be usable.
      So I tried the new source exclusion feature:

      • when I put "src/main/antlr/*", sonar tries to run all my tests internal classes as unit tests. I eventually figured out that it overrides the default value in surefire that is **/$* to avoid this
      • then I put "src/main/antlr/*" and "/$*" but the build gave no data in the database. This is certainly because the sonar-pom.xml contains the exclusions and the "$" has a signification in a pom.xml and cannot be escaped
      • last, I tried to configure each plugin for a sonar specific profile only activated for the sonar build like below. But the maven build raised an exception.
        Something is missing...

      Here is the pom profile I used (my antlr grammar is in a package that contains the name "antlr)
      <profile>
      <id>sonar-build</id>
      <activation>
      <property>
      <name>sonar</name>
      </property>
      </activation>
      <build>
      <plugins>
      <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>findbugs-maven-plugin</artifactId>
      <configuration>
      <excludeFilterFile>${basedir}/../heavenize-test-utils/src/main/resources/findbugs-excludes.xml</excludeFilterFile>
      </configuration>
      </plugin>
      <plugin>
      <artifactId>maven-checkstyle-plugin</artifactId>
      <configuration>
      <excludes>*/antlr//</excludes>
      </configuration>
      </plugin>
      <plugin>
      <artifactId>maven-pmd-plugin</artifactId>
      <configuration>
      <excludes>
      <exclude>*/antlr//</exclude>
      </excludes>
      </configuration>
      </plugin>
      <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>javancss-maven-plugin</artifactId>
      <configuration>
      <excludes>
      <exclude>*/antlr//</exclude>
      </excludes>
      </configuration>
      </plugin>
      <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>cobertura-maven-plugin</artifactId>
      <configuration>
      <instrumentation>
      <ignores>
      <ignore>*.antlr.*</ignore>
      </ignores>
      </instrumentation>
      </configuration>
      </plugin>
      <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>javancss-maven-plugin</artifactId>
      <configuration>
      <excludes>
      <exclude>*/antlr/*</exclude>
      </excludes>
      </configuration>
      </plugin>
      </plugins>
      </build>
      </profile>

      Here is hte exception :
      [17:43:38]: [INFO] Error for project: Tets Project (during org.codehaus.sonar:sonar-maven-plugin:1.8:sonar)
      [17:43:38]: [INFO] ------------------------------------------------------------------------
      [17:43:38]: [INFO] Can not execute Sonar
      [17:43:38]: Embedded error: Unable to execute mojo
      [17:43:38]: [INFO] Trace
      [17:43:38]: org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512)
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482)
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:227)
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
      [17:43:38]: at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
      [17:43:38]: at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
      [17:43:38]: at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
      [17:43:38]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [17:43:38]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      [17:43:38]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      [17:43:38]: at java.lang.reflect.Method.invoke(Method.java:597)
      [17:43:38]: at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      [17:43:38]: at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      [17:43:38]: at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      [17:43:38]: at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      [17:43:38]: Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
      [17:43:38]: at org.sonar.mojo.bootstrap.Bootstraper.executeMojo(Bootstraper.java:79)
      [17:43:38]: at org.sonar.mojo.bootstrap.Bootstraper.start(Bootstraper.java:62)
      [17:43:38]: at org.sonar.mojo.bootstrap.SonarMojo.execute(SonarMojo.java:112)
      [17:43:38]: at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
      [17:43:38]: ... 16 more
      [17:43:38]: Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to execute mojo
      [17:43:38]: at org.sonar.mojo.MojoExecutor.executeMojo(MojoExecutor.java:50)
      [17:43:38]: at org.sonar.mojo.InternalMojo.executeMojo(InternalMojo.java:232)
      [17:43:38]: at org.sonar.mojo.InternalMojo.executeMojos(InternalMojo.java:221)
      [17:43:38]: at org.sonar.mojo.InternalMojo.execute(InternalMojo.java:147)
      [17:43:38]: at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
      [17:43:38]: at org.sonar.mojo.bootstrap.Bootstraper.executeMojo(Bootstraper.java:76)
      [17:43:38]: ... 20 more
      [17:43:38]: Caused by: java.util.ConcurrentModificationException
      [17:43:38]: at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
      [17:43:38]: at java.util.AbstractList$Itr.next(AbstractList.java:343)
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings(DefaultLifecycleExecutor.java:1002)
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:787)
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:767)
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:529)
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512)
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482)
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
      [17:43:38]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
      [17:43:38]: at org.sonar.mojo.MojoExecutor.executeMojo(MojoExecutor.java:45)
      [17:43:38]: ... 25 more

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              freddy.mallet Freddy Mallet (Inactive)
              Reporter:
              littlejoz Jose CHILLAN
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: