Hosted Gitlab + SonarCloud

  • ALM used: Hosted Gitlab

  • CI system used: Hosted Gitlab

  • Scanner command used when applicable: gradle sonarqube -x testClasses -x test

  • Languages of the repository: Java

  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting):

    Task :sonarqube FAILED
    FAILURE: Build failed with an exception.
    What went wrong:
    Execution failed for task ‘:sonarqube’.
    Please provide compiled classes of your project with sonar.java.binaries property

  • Steps to reproduce - follow basic instructions on sonarcloud.io to integrate my Hosted Gitlab java project with SonarCloud by modifying my build.gradle and .gitlab-i.yaml files.

I have tried adding the property “sonar.java.binaries”, “**/classes” to the build.gradle sonarqube properties section along with a few other values for the location and nothing works.

When I run this same exact command locally on the same project targeting my locally running sonarqube server, it works just perfectly. Not really sure what is wrong with my configuration to get the Gitlab hosted CI pipeline to work with the Sonarcloud integration.

Anyone have any ideas?

Hi Rob,

I know nothing about Gitlab ALM and Gitlab CI but I work on the java analyzer side that complains about sonar.java.binaries missing property.
So I tried to follow Gitlab and SonarCloud guide to reproducing your problem.
I created a Gitlab project:
https://gitlab.com/alban-auzeill/hello-world-gradle

I created a SonarCloud account, and add analysis of my project by adding this commit:
commit/d2282be1f
The CI is green and I can see the analysis on SonarCloud :smiley::
https://sonarcloud.io/dashboard?id=alban-auzeill_hello-world-gradle

What is different in your project configuration?