How do I force analysis of a project that has both Gradle and node?

I have a project that has both Node and Gradle.

More fixes · trajano/spring-cloud-demo@a6dab63 (

The tool detects the gradle and errors out. Is there a way to make it ignore it?

Hey there.

What’s your end goal?

  • Analyze the Java Code and Javascript code together
  • Only analyze the Javascript (Node) code?

If it’s the former, you’ll have to use the Scanner for Gradle – there’s no way around it.

If you’re only trying to analyze the other code… I’d be interested in hearing more about your usecase.

Not sure what you mean by “scanner for gradle”
But I’m simply just trying to do an analysis of code that’s right now a single code base because I am learning to integrate both a java backend and a React Native front end in a single mono repo / gradle multiproject repository.

Did the documentation I linked help? :smiley:

1 Like

Not really because I have used this for Gradle already before when it was just the server side. The problem was when I introduce a NodeJS project (i.e. the client side) code which is written in a totally different language/platform the tool detects that it is a Gradle project and it is forcing me to run Gradle only.

Here’s where I have it, it’s been there for a while.

It is called via

I don’t mind having two different .github/workflow files one for app and one for the server. The closest solution I can think of to resolve this at the moment is to break it into two git repos but that’s something I am holding off for now since I work on the files together.

My current build file is for the app’s sonar is here

Hey there.

I think I understand your context a bit better now – thanks! This will be a multi-part explanation.

The SonarScanner for Gradle (which you’re already using) isn’t analyzing your NodeJS (Typescript) files because the Scanner for Gradle derives sonar.sources from the information available to Gradle. Specifically ${sourceSets.main.allSource.srcDirs}.

You can check the Scanner for Gradle documentation on Analyzing custom source sets to try and add additional files, but this is tricky and I don’t have a good example to share. There may be more sophisticated ways to work a Node project into a Gradle project – but I don’t know it. :zipper_mouth_face:

Back to the the SonarCloud Scan Action… that is being prevented from running based on this condition (which checks the base directory for a build.gradle file). It’s not sophisticated enough to understand that you want to analyze all the stuff that isn’t already being analyzed the Scanner for Gradle.

Something you could try if all of your Typescript files are isolated to a given subdirectory, you can use the projectBaseDir property to tell the action to start from another directory (where no build.gradle file is found)

uses: sonarsource/sonarcloud-github-action@master
  projectBaseDir: my-custom-directory

The typescript files are isolated in a directory, BUT… the yarn.lock files are on the root. But I can try that out.