Azure Devops SonarCloud Java Pipeline failing

We are including SonarCloud into our organization in Azure Devops. Followed process shown in SonarCloud UI to include steps for code analysis in Classic editor Java pipeline. The pipeline runs fine without sonarcloud code analysis step but fails when we enable it in gradelw step. PFB error message.

Please note as mentioned in SonarCloud website checked “Code Analysis — Run SonarQube or SonarCloud Analysis” in pipeline instead of adding Run Analysis Task in pipeline.

2023-06-15T20:30:59.2943010Z ##[section]Starting: gradlew build
2023-06-15T20:30:59.2947982Z ==============================================================================
2023-06-15T20:30:59.2948107Z Task         : Gradle
2023-06-15T20:30:59.2948411Z Description  : Build using a Gradle wrapper script
2023-06-15T20:30:59.2948493Z Version      : 3.221.0
2023-06-15T20:30:59.2948567Z Author       : Microsoft Corporation
2023-06-15T20:30:59.2948636Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/gradle
2023-06-15T20:30:59.2948733Z ==============================================================================
2023-06-15T20:30:59.5380905Z ##[warning]Used 'chmod' method for gradlew file to make it executable.
2023-06-15T20:30:59.5868086Z SonarQube analysis is enabled.
2023-06-15T20:30:59.5871886Z [command]/home/vsts/work/1/s/gradlew build sonarqube
2023-06-15T20:30:59.6973880Z Downloading https://services.gradle.org/distributions/gradle-6.9.1-bin.zip
2023-06-15T20:31:01.5719438Z ..........10%..........20%..........30%...........40%..........50%..........60%..........70%...........80%..........90%..........100%
2023-06-15T20:31:02.7680516Z 
2023-06-15T20:31:02.7681223Z Welcome to Gradle 6.9.1!
2023-06-15T20:31:02.7681384Z 
2023-06-15T20:31:02.7681624Z Here are the highlights of this release:
2023-06-15T20:31:02.7682119Z  - This is a small backport release.
2023-06-15T20:31:02.7683708Z  - Java 16 can be used to compile when used with Java toolchains
2023-06-15T20:31:02.7684077Z  - Dynamic versions can be used within plugin declarations
2023-06-15T20:31:02.7684419Z  - Native support for Apple Silicon processors
2023-06-15T20:31:02.7684582Z 
2023-06-15T20:31:02.7685513Z For more details see https://docs.gradle.org/6.9.1/release-notes.html
2023-06-15T20:31:02.7685728Z 
2023-06-15T20:31:02.8591466Z Starting a Gradle Daemon (subsequent builds will be faster)
2023-06-15T20:31:09.7626854Z 
2023-06-15T20:31:09.7627474Z FAILURE: Build failed with an exception.
2023-06-15T20:31:09.7627570Z 
2023-06-15T20:31:09.7629471Z * What went wrong:
2023-06-15T20:31:09.7630380Z A problem occurred configuring root project 's'.
2023-06-15T20:31:09.7630740Z > Could not resolve all artifacts for configuration ':classpath'.
2023-06-15T20:31:09.7631095Z    > Could not resolve com.fasterxml.jackson.module:jackson-module-parameter-names:2.13.2.
2023-06-15T20:31:09.7631310Z      Required by:
2023-06-15T20:31:09.7631796Z          project : > org.springframework.boot:org.springframework.boot.gradle.plugin:2.6.6 > org.springframework.boot:spring-boot-gradle-plugin:2.6.6 > org.springframework.boot:spring-boot-buildpack-platform:2.6.6
2023-06-15T20:31:09.7632630Z          project : > org.springframework.boot:org.springframework.boot.gradle.plugin:2.6.6 > org.springframework.boot:spring-boot-gradle-plugin:2.6.6 > org.springframework.boot:spring-boot-buildpack-platform:2.6.6 > com.fasterxml.jackson.core:jackson-databind:2.13.2.2 > com.fasterxml.jackson:jackson-bom:2.13.2
2023-06-15T20:31:09.7633219Z       > Could not resolve com.fasterxml.jackson.module:jackson-module-parameter-names:2.13.2.
2023-06-15T20:31:09.7633706Z          > Could not get resource 'https://plugins.gradle.org/m2/com/fasterxml/jackson/module/jackson-module-parameter-names/2.13.2/jackson-module-parameter-names-2.13.2.pom'.
2023-06-15T20:31:09.7634189Z             > Could not GET 'https://jcenter.bintray.com/com/fasterxml/jackson/module/jackson-module-parameter-names/2.13.2/jackson-module-parameter-names-2.13.2.pom'.
2023-06-15T20:31:09.7634424Z                > peer not authenticated
2023-06-15T20:31:09.7634488Z 
2023-06-15T20:31:09.7634603Z * Try:
2023-06-15T20:31:09.7634936Z Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
2023-06-15T20:31:09.7635394Z 
2023-06-15T20:31:09.7635542Z * Get more help at https://help.gradle.org
2023-06-15T20:31:09.7635617Z 
2023-06-15T20:31:09.7635740Z BUILD FAILED in 10s
2023-06-15T20:31:10.2625819Z Error: The process '/home/vsts/work/1/s/gradlew' failed with exit code 1
2023-06-15T20:31:10.2627394Z     at ExecState._setResult (/home/vsts/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/3.221.0/node_modules/azure-pipelines-task-lib/toolrunner.js:943:25)
2023-06-15T20:31:10.2633882Z     at ExecState.CheckComplete (/home/vsts/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/3.221.0/node_modules/azure-pipelines-task-lib/toolrunner.js:926:18)
2023-06-15T20:31:10.2634455Z     at ChildProcess.<anonymous> (/home/vsts/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/3.221.0/node_modules/azure-pipelines-task-lib/toolrunner.js:839:19)
2023-06-15T20:31:10.2634733Z     at ChildProcess.emit (node:events:513:28)
2023-06-15T20:31:10.2634947Z     at maybeClose (node:internal/child_process:1093:16)
2023-06-15T20:31:10.2635193Z     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
2023-06-15T20:31:10.2639547Z ##[error]Code analysis failed. Gradle exit code: -1. Error: Error: The process '/home/vsts/work/1/s/gradlew' failed with exit code 1
2023-06-15T20:31:10.2675916Z ##[section]Finishing: gradlew build

Hi,

Welcome to the community!

You mentioned you added a gradle step for analysis. How are you building the Java code in your project?

 
Ann

There is not separate step for building java code. Gradlew step is there only. Attaching snaps.


snap1

Hi,

To be clear, the gradlew build step was already there, and the only change you made was to check the “Run SonarQube or SonarCloud Analysis” box?

 
Thx,
Ann

yes. I also added below sonarcloud tasks also. I followed the process mentioned under maven analysis in sonarcloud.

  1. Prepare analysis on SonarCloud
  2. Publish Quality Gate Result
1 Like

Hey @dipa5b,

I am not sure I am following: Are you mixing manual Maven and Gradle analysis instructions to integrate with SonarCloud?

Best,

Dorian

Any update on this ?

Hey @jayu7192,
We are waiting for an answer from @dipa5b but if you are facing a similar problem, please open a new thread.

Cheers,

Dorian

Hi, I am trying to implement the same using Sonarqube enterprise edition. Will share details once I have a clear understanding.