SonarQube Eclipse
  1. SonarQube Eclipse
  2. SONARIDE-294

Findbugs analyses wrong binaries, if build-helper is used

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 3.0
    • Component/s: Java
    • Labels:
    • Environment:
      java 1.6.0_29 32bit, Eclipse 3.7, Sonar 2.13.1, SonarIDE 2.3
    • Number of attachments :
      0

      Description

      Using mavens build-helper and eclipse causes following .classpath files (see the missing output attribute for all main sources; instead the default output folder is addedd by kind="output")

      <classpath>
         <classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
         <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
         <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
         <classpathentry kind="src" path="src/main/buildsupport" including="**/*.java"/>
         <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
         <classpathentry kind="output" path="target/classes"/>
         ...
      

      running sonar with the maven-plugin does correctly analyses the files in target/classes (default maven structure folder), but running sonar from within eclipse anaylises target/test-classes. Nothing more.

        Issue Links

          Activity

          Hide
          Robert Kleinschmager added a comment -

          By browsing the code I found, that org.sonar.ide.eclipse.internal.jdt.JavaProjectConfigurator does a good job and adds all potential output folders to the ProjectDefinition. But org.sonar.batch.DefaultProjectFileSystem2.getBuildOutputDir() just returns one of the output folders (in out case always the wrong one). It seems, that ProjectDefinition is capable of multiple output folders, but DefaultProjectFileSystem2 and all bytecode-analising plugins (findbugs, jacoco, ???) not.

          I would like to fix this issue - what would you recommend? Extending the api to support multiple output-folders or change DefaultProjectFileSystem2 in another way? Why is DefaultProjectFileSystem2 relying on ProjectDefinition and the MavenProject?

          Show
          Robert Kleinschmager added a comment - By browsing the code I found, that org.sonar.ide.eclipse.internal.jdt.JavaProjectConfigurator does a good job and adds all potential output folders to the ProjectDefinition . But org.sonar.batch.DefaultProjectFileSystem2.getBuildOutputDir() just returns one of the output folders (in out case always the wrong one). It seems, that ProjectDefinition is capable of multiple output folders, but DefaultProjectFileSystem2 and all bytecode-analising plugins (findbugs, jacoco, ???) not. I would like to fix this issue - what would you recommend? Extending the api to support multiple output-folders or change DefaultProjectFileSystem2 in another way? Why is DefaultProjectFileSystem2 relying on ProjectDefinition and the MavenProject ?
          Hide
          Ruben Martin Pozo added a comment -

          Exactly the same thing is happening to us but only for the findbugs analyzer. Pmd and checkstyle works perfectly but findbugs only sees the test folder. I guess findbugs needs to see the .java files while pmd and checkstyle only need to see the .class file and that's why findbugs misses some source folders

          Just guessing

          Show
          Ruben Martin Pozo added a comment - Exactly the same thing is happening to us but only for the findbugs analyzer. Pmd and checkstyle works perfectly but findbugs only sees the test folder. I guess findbugs needs to see the .java files while pmd and checkstyle only need to see the .class file and that's why findbugs misses some source folders Just guessing
          Hide
          Julien HENRY added a comment -

          There is a bug on Sonar side (SONAR-3739).

          But thanks to the implementation of SONARIDE-209 the output dir for test folders will no more be included in the analysis. As a result your issue should be fixed as there will be only one output folder.

          Show
          Julien HENRY added a comment - There is a bug on Sonar side ( SONAR-3739 ). But thanks to the implementation of SONARIDE-209 the output dir for test folders will no more be included in the analysis. As a result your issue should be fixed as there will be only one output folder.

            People

            • Assignee:
              Julien HENRY
              Reporter:
              Robert Kleinschmager
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: