Failed build using SonarCloud analyzing github Action CI

I’m trying to configure sonarcloud in a monorepo structure, Java 17 with Gradle 7.4, but it returns me with an error in Build and Analyze. says it didn’t find the Gradle build.
I believe I need to point the way, but I don’t know how.
Can anyone help?

Result Build and Analyze

Run ./back/condominioPlus/gradlew build sonarqube --info
Initialized native services in: /home/runner/.gradle/native
Initialized jansi services in: /home/runner/.gradle/native

Welcome to Gradle 7.4.1!

Here are the highlights of this release:
 - Aggregated test and JaCoCo reports
 - Marking additional test source directories as tests in IntelliJ
 - Support for Adoptium JDKs in Java toolchains

For more details see

Removing 0 daemon stop events from registry
Starting a Gradle Daemon (subsequent builds will be faster)
Starting process 'Gradle build daemon'. Working directory: /home/runner/.gradle/daemon/7.4.1 Command: /opt/hostedtoolcache/jdk/17.0.2/x64/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/ --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.language=en -Duser.variant -cp /home/runner/.gradle/wrapper/dists/gradle-7.4.1-bin/58kw26xllvsiedyf3nujyarhn/gradle-7.4.1/lib/gradle-launcher-7.4.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 7.4.1
Successfully started process 'Gradle build daemon'
An attempt to start the daemon took 0.948 secs.
The client will now receive all logging from the daemon (pid: 1754). The daemon log file: /home/runner/.gradle/daemon/7.4.1/daemon-1754.out.log
Starting build in new daemon [memory: 512 MiB]
Closing daemon's stdin at end of input.
The daemon will no longer process any standard input.

Using 2 worker leases.
FAILURE: Build failed with an exception.

* What went wrong:
Directory '/home/runner/work/condominio/condominio' does not contain a Gradle build.

A Gradle build should contain a 'settings.gradle' or 'settings.gradle.kts' file in its root directory. It may also contain a 'build.gradle' or 'build.gradle.kts' file.

To create a new Gradle build in this directory run 'gradlew init'

For more detail on the 'init' task see

For more detail on creating a Gradle build see

* Try:
> Run gradlew init to create a new Gradle build in this directory.
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.

* Get more help at

Error: Process completed with exit code 1.

action file (github)

name: Build
      - main
      - origin/main
    types: [opened, synchronize, reopened]
    name: Build
    runs-on: ubuntu-latest
      - uses: actions/checkout@v2
          fetch-depth: 0  # Shallow clones should be disabled for a better relevancy of analysis
      - name: Set up JDK 17
        uses: actions/setup-java@v1
          java-version: 17
      - name: Cache SonarCloud packages
        uses: actions/cache@v1
          path: ~/.sonar/cache
          key: ${{ runner.os }}-sonar
          restore-keys: ${{ runner.os }}-sonar
      - name: Cache Gradle packages
        uses: actions/cache@v1
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
          restore-keys: ${{ runner.os }}-gradle
      - name: Grant execute permission for gradlew
        run: chmod +x ./back/condominioPlus/gradlew
      - name: Build and analyze
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
        run: ./back/condominioPlus/gradlew build sonarqube --info 

Hey there.

What happens if you remove the sonarqube task from the Gradle command – does it still fail?

Removing build and analysis from sona git manages to finish the build


Okay. What about just gradle build?

I need sonar to check the code. This code from build.yml was the sonarcloud site that delivers to create an action within git, but my project is in a subfolder the same as I put it in run on the last line, without this line the build works, but sonar doesn’t check .

Hey there.

What I’m suggesting is that you need to make sure gradle build works by itself before trying to run gradle build sonarqube – without gradle build (which it appears you’ve commented out entirely) – you aren’t actually building anything.