sgoertzen / sonar-break-maven-plugin

Fail your maven build if sonar detects issues with the code
MIT License
10 stars 15 forks source link

Failed to execute goal - always timed out #30

Closed yuvarajapril91 closed 8 years ago

yuvarajapril91 commented 8 years ago

I'm trying to build my code with sonar-break-maven-plugin 1.2, sonar-maven-plugin 3.0.2 in Maven 3.0.4. Irrespective of the Quality Gate status in sonarqube(5.5), the goal always fails with timeout.

The values for sonarLookBackSeconds and waitForProcessingSeconds - tried all the default values and max 600 seconds too, still it gets timed out always.

Logs: [DEBUG] Configuring mojo com.github.sgoertzen:sonar-break-maven-plugin:1.2:sonar-break from plugin realm ClassRealm[plugin>com.github.sgoertzen:sonar-break-maven-plugin:1.2, parent: sun.misc.Launcher$AppClassLoader@19134f4] [DEBUG] Configuring mojo 'com.github.sgoertzen:sonar-break-maven-plugin:1.2:sonar-break' with basic configurator --> DEBUG sonarLookBackSeconds = 10 DEBUG sonarServer = http://localhost:9000 DEBUG waitForProcessingSeconds = 20 [DEBUG] -- end configuration -- [INFO] Querying sonar for analysis on appName, version: 1.0.0 [DEBUG] Parameter sonarLookBackSeconds set to value of 10 [DEBUG] Parameter waitForProcessingSeconds set to value of 20 [DEBUG] Built a sonar query url of: http://localhost:9000/api/resources/index?resource=appName&metrics=quality_gate_details [DEBUG] Got a valid response of 200 from http://localhost:9000 [DEBUG] Got a valid response of 200 from http://localhost:9000/api/resources/index?resource=appName&metrics=quality_gate_details [DEBUG] Sleeping while waiting for sonar to process job. Target Version: 1.0.0. Sonar reporting Version: 1.0.0. Looking back until: 2016-08-31T15:29:53.286+05:30 Last result time: 2016-08-31T14:52:54.000+05:30 [DEBUG] Got a valid response of 200 from http://localhost:9000/api/resources/index?resource=appName&metrics=quality_gate_details [DEBUG] Sleeping while waiting for sonar to process job. Target Version: 1.0.0. Sonar reporting Version: 1.0.0. Looking back until: 2016-08-31T15:29:53.286+05:30 Last result time: 2016-08-31T14:52:54.000+05:30 [INFO]
[INFO] ------------------------------------------------------------------------ [INFO] Skipping appName Maven Webapp [INFO] This project has been banned from the build due to previous failures. [INFO] ------------------------------------------------------------------------ [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] appName ................................. FAILURE [26.557s] [INFO] appName1......................................... SKIPPED [INFO] appName2.......................................... SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 27.257s [INFO] Finished at: Wed Aug 31 15:30:27 IST 2016 [INFO] Final Memory: 6M/18M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.github.sgoertzen:sonar-break-maven-plugin:1.2:sonar-break (default-cli) on project appName: Error while running sonar break: Timed out while waiting for Sonar. Waited 20 seconds. This time can be extended using the "waitForProcessingSeconds" configuration parameter. -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.sgoertzen:sonar-break-maven-plugin:1.2:sonar-break (default-cli) on project appName: Error while running sonar break 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:320) 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:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) 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: Error while running sonar break at com.sgoertzen.sonarbreak.SonarBreakMojo.execute(SonarBreakMojo.java:58) 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: com.sgoertzen.sonarbreak.SonarBreakException: Timed out while waiting for Sonar. Waited 20 seconds. This time can be extended using the "waitForProcessingSeconds" configuration parameter. at com.sgoertzen.sonarbreak.QueryExecutor.fetchSonarStatusWithRetries(QueryExecutor.java:126) at com.sgoertzen.sonarbreak.QueryExecutor.execute(QueryExecutor.java:69) at com.sgoertzen.sonarbreak.SonarBreakMojo.execute(SonarBreakMojo.java:54) ... 21 more [ERROR] [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

sgoertzen commented 8 years ago

Hmmm, it could be a couple different issues.

  1. Is this a big project? Sonar could be taking a very long time to process in which case it would go past the 20 seconds. I've never seen a project go over 600 seconds though for processing. Can you re-run this with waitForProcessingSeconds = 600 and post the logs again? When you do this you should see in the maven logs this specific line: DEBUG waitForProcessingSeconds = 600
  2. It looks like the version of your code is always at 1.0. This shouldn't be a problem, but it is one of the items that the plugin uses to determine if sonar is done processing. Can you try changing it to 1.0.1 or something and re-run?
  3. If neither of those give us any more info we may need to look into the sonar logs.

Also thanks for running this with debug enabled and posting the logs. That makes it much easier to trouble shoot this. 👍

yuvarajapril91 commented 8 years ago

Hi Sgoertzen,

Found the issue. Its with sonarLookBackSeconds. I increased it to some 180 seconds and it is working like a charm. Hence closing this issue.

Thanks for your immediate response.