SonarQube Plugins
  1. SonarQube Plugins
  2. SONARPLUGINS-2004

Nullpointer in SonargraphSensor if a maven parent project contains modules that have no sources

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: SONARGRAPH-3.0.4
    • Component/s: Sonargraph
    • Labels:
      None
    • Number of attachments :
      0

      Description

      I have a maven parent project that consists of several sub modules. One of these projects uses a custom package type and does not have any sources. If this module is included in the build then I get the following error

      [ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project cbdp-maven-playground: Can not execute Sonar: NullPointerException -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project cbdp-maven-playground: Can not execute Sonar
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
      Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
      at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:118)
      at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
      at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:90)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
      ... 19 more
      Caused by: java.lang.NullPointerException
      at com.hello2morrow.sonarplugin.api.SonargraphSensor.analyseCylceGroups(SonargraphSensor.java:270)
      at com.hello2morrow.sonarplugin.api.SonargraphSensor.analyse(SonargraphSensor.java:154)
      at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64)
      at org.sonar.batch.phases.Phases.execute(Phases.java:93)
      at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:143)
      at org.sonar.batch.bootstrap.Module.start(Module.java:83)
      at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:115)
      at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:110)
      at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:105)
      at org.sonar.batch.bootstrap.Module.start(Module.java:83)
      at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:109)
      at org.sonar.batch.bootstrap.Module.start(Module.java:83)
      at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:72)
      at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:59)
      at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:143)
      at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)
      ... 23 more

        Activity

        Hide
        Jelmer Kuperus added a comment -

        The workaround for me was to eclude the module from sonar like this :

        <properties>
        <sonar.skippedModules>modulename</sonar.skippedModules>
        </properties>

        Show
        Jelmer Kuperus added a comment - The workaround for me was to eclude the module from sonar like this : <properties> <sonar.skippedModules>modulename</sonar.skippedModules> </properties>
        Hide
        Ingmar Kellner added a comment -

        Modules not containing any code are detected by Sonargraph plugin and will be skipped from further processing.

        Show
        Ingmar Kellner added a comment - Modules not containing any code are detected by Sonargraph plugin and will be skipped from further processing.

          People

          • Assignee:
            Ingmar Kellner
            Reporter:
            Jelmer Kuperus
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: