Error in Gradle build

Hello.
We have created a pipeline on DevOps and performed a Sonarcloud analysis.
I got the following error in gradlew build.

“##[error]Code analysis failed. Gradle exit code: -1. Error: Error: The process ‘D:\a\8\s\gradlew.bat’ failed with exit code 1”

How should I investigate and resolve this issue?

Hey there.

Can you share how your Azure DevOps pipeline is configured?

Is that all the log output you have?

Thanks for the reply.

The target program is made with Java version 8 and the pipeline configuration is as follows.
・Select a source is “TFVC”.
・Agent Specification is “Windows 2019”.
・Choose the way to run the analysis is “Integrate with Maven or Gradle”.
・JDK version is “11”.
・SonarQube scanner for Gradle plugin version is 3.0

Can you share the full logs from your pipeline?

logs_1299.zip (104.9 KB)
The log can be found here.
Note that the source was made in Java 8, so I ran it with a different configuration that I contacted the other day.

JDK version is “8”.
SonarQube scanner for Gradle plugin version is 2.8

Is this due to an older version of Java?(Does SonarCloud not support Java 8?)
I would like to solve this problem as soon as possible, can you please tell me how to deal with it?

Thank you in advance.

Hey there.

I think you’re using such an old version of the Gradle plugin, that the logs aren’t properly piped out.

Can you try using the latest version, v5.0.0.4638? Or at least, the last version which supported Java 8 (4.0.0.2929)?

I can’t say for sure until we have real logs related to the execution/failure.

What I can say is that Java 17 is required to run gradle sonar against SonarCloud, and if that isn’t the version of Java that you use to run your build, you’ll have to switch out the version of Java before running gradle sonar.

That said, you’ll have to do that (gradle sonar) in a separate command-line step rather than as part of the Gradle build task in Azure DevOps.

Thank you very much.
We have implemented the plugin version 5.0.0.4638. I will send you the log here so you can check it.

I will look into switching versions.
logs_1337.zip (154.7 KB)

Thanks! Those logs aren’t any more helpful, unfortunately.

At this point, I’d really suggest keeping your build as is, but move your SonarCloud analysis outside the gradle task (set sonarQubeRunAnalysis to false) and add two tasks that

  • switch JAVA_HOME to point to Java 17
  • run gradle sonar

Colin, thanks for the advice!
I do not have SonarCube and can only use SonarCloud. Does this mean that this problem cannot be solved with SonarCloud?

Also, is this problem caused by an older version of Java? Please let me know the possible causes.

Sorry, I meant to say SonarCloud :slight_smile: (although the task parameter is the same).

I’m pretty sure that’s why analysis fails to get started. In any case, it certainly won’t progress any further if you’re using Java 8 (although like I said, the analysis needs to use Java 17, not your build).

Thank you for answering my question.
I ended up analyzing the program by giving it a Java version.

I was able to analyze it and found the results of the analysis, so this matter has been resolved.