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

Improve error log when there is a failure in a ProjectBuilder

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0
    • Component/s: Scanner
    • Labels:
      None

      Description

      When a plugin implement a ProjectBuilder and there is an error during its execution the stacktrace in logs is bloated and the original error is hard to find:

      [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2:sonar (default-cli) on project java-sample: Unable to load component class org.sonar.batch.scan.ImmutableProjectReactor: <Original message> -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2:sonar (default-cli) on project java-sample: Unable to load component class org.sonar.batch.scan.ImmutableProjectReactor
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
      	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:116)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
      	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
      	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
      	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
      Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to load component class org.sonar.batch.scan.ImmutableProjectReactor
      	at org.sonarsource.scanner.maven.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:36)
      	at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:81)
      	at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:112)
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
      	... 20 more
      Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.batch.scan.ImmutableProjectReactor
      	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:69)
      	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
      	at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
      	at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
      	at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
      	at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
      	at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
      	at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
      	at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
      	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
      	at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
      	at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
      	at org.picocontainer.DefaultPicoContainer.instantiateComponentAsIsStartable(DefaultPicoContainer.java:1034)
      	at org.picocontainer.DefaultPicoContainer.addAdapterIfStartable(DefaultPicoContainer.java:1026)
      	at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1003)
      	at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
      	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:141)
      	at org.sonar.batch.scan.ProjectScanContainer.startComponents(ProjectScanContainer.java:128)
      	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
      	at org.sonar.batch.task.ScanTask.execute(ScanTask.java:55)
      	at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
      	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
      	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
      	at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:124)
      	at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
      	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
      	at com.sun.proxy.$Proxy23.execute(Unknown Source)
      	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:240)
      	at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
      	at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:78)
      	... 23 more
      Caused by: <Original message>.
      

      Executing code that could fail in a ProviderAdapter doesn't seem to be a good idea so we should rework ImmutableProjectReactorProvider.

        Attachments

          Activity

            People

            • Assignee:
              duarte.meneses Duarte Meneses
              Reporter:
              julien.henry Julien Henry
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: