I am trying the sample to build a workflow for a simple API like: https://plainenglish.io/blog/hands-on-ci-cd-for-spring-boot-applications-using-github-actions-and-aws-1cbc1e2c9d54
However, when I try to use it on Java 17. It occurs the following Error. After searching, I know it may be related to the version of SonarQube which is 8.0.0.37226. I think it can be fixed on the 9 or above version but I can’t find where can I set the version in pom.xml or .github/workflows/build.yml. Can anyone show suggest how to change the version or where should I find the document about this?
Error message:
Error: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar (default-cli) on project first-app: closed -> [Help 1]
Error:
Error: To see the full stack trace of the errors, re-run Maven with the -e switch.
Error: Re-run Maven using the -X switch to enable full debug logging.
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
Error: Process completed with exit code 1.
SonarQube version is showing in the workflow.
[INFO] ----------------------< com.javaguides:first-app >----------------------
[INFO] Building first-app 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:3.9.0.2155:sonar (default-cli) @ first-app ---
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/sonarsource/scanner/api/sonar-scanner-api/2.16.1.361/sonar-scanner-api-2.16.1.361.pom
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/sonarsource/scanner/api/sonar-scanner-api/2.16.1.361/sonar-scanner-api-2.16.1.361.pom (5.2 kB at 199 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/sonarsource/scanner/api/sonar-scanner-api-parent/2.16.1.361/sonar-scanner-api-parent-2.16.1.361.pom
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/sonarsource/scanner/api/sonar-scanner-api-parent/2.16.1.361/sonar-scanner-api-parent-2.16.1.361.pom (4.8 kB at 191 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/sonarsource/scanner/api/sonar-scanner-api/2.16.1.361/sonar-scanner-api-2.16.1.361.jar
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/sonarsource/scanner/api/sonar-scanner-api/2.16.1.361/sonar-scanner-api-2.16.1.361.jar (625 kB at 7.3 MB/s)
[INFO] User cache: /home/runner/.sonar/cache
[INFO] SonarQube version: 8.0.0.37226
[INFO] Default locale: "en", source code encoding: "UTF-8"
Gah! I totally overlooked that you filed this in SonarCloud, where the version number is a red herring & can’t be changed (by us). Sorry about that!
Can you provide the full analysis log?
The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.
Going back to your pom, it’s best not to pin the scanner version if you don’t absolutely have to. Just remove that the latest version should be removed automatically.
Regarding your error, could you add -X to the analysis command to turn on debug logging & post the new analysis log? BTW, it looks like I only need log 6. Hopefully debug logging will give us more detail on the analysis upload error.
It seems to be too many words in the log I can paste the full of them here, the following is part of the log.
you can also check the full log through this link: share
2023-02-07T15:09:17.6124091Z [INFO] ------------------------------------------------------------------------
2023-02-07T15:09:17.6124715Z [INFO] BUILD FAILURE
2023-02-07T15:09:17.6125570Z [INFO] ------------------------------------------------------------------------
2023-02-07T15:09:17.6126105Z [INFO] Total time: 46.873 s
2023-02-07T15:09:17.6127240Z [INFO] Finished at: 2023-02-07T15:09:17Z
2023-02-07T15:09:17.6127816Z [INFO] ------------------------------------------------------------------------
2023-02-07T15:09:17.6140252Z [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project first-app: closed -> [Help 1]
2023-02-07T15:09:17.6141542Z org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project first-app: closed
2023-02-07T15:09:17.6142414Z at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:375)
2023-02-07T15:09:17.6143215Z at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
2023-02-07T15:09:17.6144881Z at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
2023-02-07T15:09:17.6145529Z at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
2023-02-07T15:09:17.6146137Z at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
2023-02-07T15:09:17.6147112Z at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
2023-02-07T15:09:17.6147943Z at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
2023-02-07T15:09:17.6149196Z at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
2023-02-07T15:09:17.6150037Z at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
2023-02-07T15:09:17.6150576Z at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:298)
2023-02-07T15:09:17.6150994Z at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
2023-02-07T15:09:17.6151402Z at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
2023-02-07T15:09:17.6151788Z at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
2023-02-07T15:09:17.6152180Z at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
2023-02-07T15:09:17.6152552Z at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
2023-02-07T15:09:17.6152974Z at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
2023-02-07T15:09:17.6153481Z at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
2023-02-07T15:09:17.6154054Z at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
2023-02-07T15:09:17.6154522Z at java.lang.reflect.Method.invoke (Method.java:568)
2023-02-07T15:09:17.6154980Z at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
2023-02-07T15:09:17.6155502Z at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
2023-02-07T15:09:17.6156034Z at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
2023-02-07T15:09:17.6156556Z at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
2023-02-07T15:09:17.6157009Z Caused by: org.apache.maven.plugin.MojoExecutionException: closed
2023-02-07T15:09:17.6157536Z at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute (ScannerBootstrapper.java:67)
2023-02-07T15:09:17.6158089Z at org.sonarsource.scanner.maven.SonarQubeMojo.execute (SonarQubeMojo.java:108)
2023-02-07T15:09:17.6158638Z at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
2023-02-07T15:09:17.6159198Z at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
2023-02-07T15:09:17.6159726Z at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
2023-02-07T15:09:17.6160230Z at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
2023-02-07T15:09:17.6160728Z at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
2023-02-07T15:09:17.6161217Z at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
2023-02-07T15:09:17.6161815Z at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
2023-02-07T15:09:17.6162484Z at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
2023-02-07T15:09:17.6163193Z at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
2023-02-07T15:09:17.6163839Z at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
2023-02-07T15:09:17.6164320Z at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:298)
2023-02-07T15:09:17.6164722Z at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
2023-02-07T15:09:17.6165127Z at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
2023-02-07T15:09:17.6165518Z at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
2023-02-07T15:09:17.6166056Z at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
2023-02-07T15:09:17.6166436Z at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
2023-02-07T15:09:17.6166856Z at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
2023-02-07T15:09:17.6167451Z at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
2023-02-07T15:09:17.6168012Z at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
2023-02-07T15:09:17.6168476Z at java.lang.reflect.Method.invoke (Method.java:568)
2023-02-07T15:09:17.6168931Z at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
2023-02-07T15:09:17.6169464Z at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
2023-02-07T15:09:17.6170046Z at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
2023-02-07T15:09:17.6170565Z at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
2023-02-07T15:09:17.6170967Z Caused by: java.lang.IllegalStateException: closed
2023-02-07T15:09:17.6171330Z at okio.RealBufferedSource.select (RealBufferedSource.kt:218)
2023-02-07T15:09:17.6178567Z at okhttp3.internal.Util.readBomAsCharset (Util.kt:265)
2023-02-07T15:09:17.6180297Z at okhttp3.ResponseBody.string (ResponseBody.kt:187)
2023-02-07T15:09:17.6182102Z at org.sonarqube.ws.client.OkHttpResponse.content (OkHttpResponse.java:67)
2023-02-07T15:09:17.6183784Z at org.sonar.scanner.bootstrap.DefaultScannerWsClient.failIfUnauthorized (DefaultScannerWsClient.java:82)
2023-02-07T15:09:17.6185458Z at org.sonar.scanner.bootstrap.DefaultScannerWsClient.call (DefaultScannerWsClient.java:61)
2023-02-07T15:09:17.6187032Z at org.sonar.scanner.report.ReportPublisher.upload (ReportPublisher.java:222)
2023-02-07T15:09:17.6188582Z at org.sonar.scanner.report.ReportPublisher.execute (ReportPublisher.java:159)
2023-02-07T15:09:17.6190192Z at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart (ProjectScanContainer.java:428)
2023-02-07T15:09:17.6190864Z at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:123)
2023-02-07T15:09:17.6192566Z at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:109)
2023-02-07T15:09:17.6194149Z at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart (GlobalContainer.java:130)
2023-02-07T15:09:17.6195741Z at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:123)
2023-02-07T15:09:17.6197279Z at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:109)
2023-02-07T15:09:17.6198761Z at org.sonar.batch.bootstrapper.Batch.doExecute (Batch.java:58)
2023-02-07T15:09:17.6199889Z at org.sonar.batch.bootstrapper.Batch.execute (Batch.java:52)
2023-02-07T15:09:17.6204455Z at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute (BatchIsolatedLauncher.java:46)
2023-02-07T15:09:17.6205132Z at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
2023-02-07T15:09:17.6205711Z at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
2023-02-07T15:09:17.6206348Z at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
2023-02-07T15:09:17.6206886Z at java.lang.reflect.Method.invoke (Method.java:568)
2023-02-07T15:09:17.6207442Z at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke (IsolatedLauncherProxy.java:60)
2023-02-07T15:09:17.6207970Z at jdk.proxy3.$Proxy24.execute (Unknown Source)
2023-02-07T15:09:17.6208452Z at org.sonarsource.scanner.api.EmbeddedScanner.doExecute (EmbeddedScanner.java:189)
2023-02-07T15:09:17.6209019Z at org.sonarsource.scanner.api.EmbeddedScanner.execute (EmbeddedScanner.java:138)
2023-02-07T15:09:17.6209639Z at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute (ScannerBootstrapper.java:65)
2023-02-07T15:09:17.6210420Z at org.sonarsource.scanner.maven.SonarQubeMojo.execute (SonarQubeMojo.java:108)
2023-02-07T15:09:17.6211042Z at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
2023-02-07T15:09:17.6211746Z at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
2023-02-07T15:09:17.6212334Z at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
2023-02-07T15:09:17.6212910Z at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
2023-02-07T15:09:17.6213481Z at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
2023-02-07T15:09:17.6214030Z at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
2023-02-07T15:09:17.6214666Z at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
2023-02-07T15:09:17.6215381Z at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
2023-02-07T15:09:17.6216140Z at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
2023-02-07T15:09:17.6235944Z at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
2023-02-07T15:09:17.6236554Z at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:298)
2023-02-07T15:09:17.6237036Z at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
2023-02-07T15:09:17.6237513Z at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
2023-02-07T15:09:17.6237978Z at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
2023-02-07T15:09:17.6238430Z at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
2023-02-07T15:09:17.6238871Z at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
2023-02-07T15:09:17.6239375Z at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
2023-02-07T15:09:17.6239959Z at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
2023-02-07T15:09:17.6240591Z at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
2023-02-07T15:09:17.6241129Z at java.lang.reflect.Method.invoke (Method.java:568)
2023-02-07T15:09:17.6241654Z at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
2023-02-07T15:09:17.6242255Z at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
2023-02-07T15:09:17.6242852Z at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
2023-02-07T15:09:17.6243431Z at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
2023-02-07T15:09:17.6243828Z [ERROR]
2023-02-07T15:09:17.6244032Z [ERROR]
2023-02-07T15:09:17.6244375Z [ERROR] For more information about the errors and possible solutions, please read the following articles:
2023-02-07T15:09:17.6244919Z [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Do you have a firewall or something else “helpful” one the network between your build agent and SonarCloud?
This error isn’t quite in the form I’m used to seeing it, but the “closed” part
makes me suspect something interfering with the upload of the analysis report to SonarCloud.
We see this sometimes with analysis reports for larger projects, where the report size crosses some arbitrary threshold and network appliances block the upload. Could something like that be happening here?
I solved it by checking all the input in build.yml and found that Dsonar.projectKey is a typo when copying. Your suggestion lead me to find my problem! Thank you!