Project contains .java files error when implementing Sonarcloud on React Native using Bitbucket Pipeline

Here’s my bitbucket-pipelines.yml:

image: feeni/node-chrome:latest

# Add extra step to increase the memory limits available on bitbucket pipeline
options:      
  docker: true 
  size: 2x

clone:
  depth: full              # SonarCloud scanner needs the full history to assign issues properly

definitions:
  caches:
    sonar: ~/.sonar/cache  # Caching SonarCloud artifacts will speed up your build
  services:
    docker:
      memory: 4096
  steps:
    - step: &build-test-sonarcloud
        name: Build, test and analyze on SonarCloud
        caches:
          - node
          - sonar
        services:
          - docker
        script:
          - npm install --quiet
          # - npm run test -- --code-coverage --no-watch --no-progress --browsers=ChromeHeadlessNoSandbox  
          - pipe: sonarsource/sonarcloud-scan:1.2.1
          - pipe: sonarsource/sonarcloud-quality-gate:0.1.4
            variables:
              SONAR_TOKEN: ${SONAR_TOKEN}
              EXTRA_ARGS: '-Dsonar.source=./ -Dsonar.exclusions=**/*.java, android/** -Dsonar.java.binaries=target/**/*.java -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info'
pipelines:
  default:
    - step: *build-test-sonarcloud
  pull-requests:
    '**':
      - step: *build-test-sonarcloud

Here’s the error I got:

`ERROR: Error during SonarScanner execution`

`org.sonar.java.AnalysisException: Your project contains .java files, please provide compiled classes with sonar.java.binaries property, or exclude them from the analysis with sonar.exclusions property.`

`	at org.sonar.java.classpath.ClasspathForMain.init(ClasspathForMain.java:75)`

`	at org.sonar.java.classpath.AbstractClasspath.getElements(AbstractClasspath.java:317)`

`	at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:175)`

`	at org.sonar.java.JavaFrontend.<init>(JavaFrontend.java:88)`

`	at org.sonar.plugins.java.JavaSensor.execute(JavaSensor.java:108)`

`	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:45)`

`	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:75)`

`	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:48)`

`	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:66)`

`	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:48)`

`	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:68)`

`	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)`

`	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)`

`	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:447)`

`	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:443)`

`	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:401)`

`	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)`

`	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)`

`	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)`

`	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)`

`	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)`

`	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)`

`	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)`

`	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)`

`	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)`

`	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)`

`	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)`

`	at java.base/java.lang.reflect.Method.invoke(Method.java:566)`

`	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)`

`	at com.sun.proxy.$Proxy0.execute(Unknown Source)`

`	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)`

`	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)`

`	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)`

`	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)`

`	at org.sonarsource.scanner.cli.Main.main(Main.java:61)`

`ERROR: `

`ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.`

Hey @Sashi,

Does it work if you remove the space from the exclusions?:

-Dsonar.exclusions=**/*.java,android/**

instead of this:

-Dsonar.exclusions=**/*.java, android/**

Best,
Marcin