Exclusion properties are not working

Hi all
i am trying to scan my project on sonar cloud using azuredevops CI pipeline but getting an error.

  • task: SonarCloudPrepare@1
  inputs:
    SonarCloud: '*****************'
    organization: '*****************'
    scannerMode: '****************'
    extraProperties: |
      # Additional properties that will be passed to the scanner,
      # Put one key=value per line, example:
      sonar.exclusions=**/camera/**/*.*
      sonar.coverage.exclusions= **/test/**/*.* , **/androidTest/**/*.*
      sonar.projectKey=**********************
      sonar.projectName=*********************
  • task: Gradle@2
  displayName: 'Execute Gradle build'
  inputs:
    gradleWrapperFile: 'gradlew'
    workingDirectory: 'path for gradlew file'
    tasks: 'assembleDebug'
    gradleOptions: '-Xmx3072m'
    javaHomeOption: 'JDKVersion'
    jdkVersionOption: '1.8'
    jdkArchitectureOption: 'x64'
    sonarQubeRunAnalysis: true
    sqGradlePluginVersionChoice: 'specify'
    sonarQubeGradlePluginVersion: '3.2.0'

Error Is

2021-09-30T07:25:09.4092798Z > Task :camera:compileDebugAndroidTestJavaWithJavac FAILED
2021-09-30T07:25:09.4095761Z /home/vsts/work/1/s/Release/Android/Native/MobileOffline/camera/src/androidTest/java/com/google/android/cameraview/AspectRatioInstrumentationTest.java:26: error: class, interface, or enum expected
2021-09-30T07:25:09.4096567Z .test.runner.AndroidJUnit4;
2021-09-30T07:25:09.4097000Z ^
2021-09-30T07:25:09.4097678Z /home/vsts/work/1/s/Release/Android/Native/MobileOffline/camera/src/androidTest/java/com/google/android/cameraview/CameraViewActions.java:22: error: class, interface, or enum expected
2021-09-30T07:25:09.4098388Z .test.espresso.UiController;
2021-09-30T07:25:09.4098839Z ^
2021-09-30T07:25:09.4099491Z /home/vsts/work/1/s/Release/Android/Native/MobileOffline/camera/src/androidTest/java/com/google/android/cameraview/CameraViewActions.java:23: error: class, interface, or enum expected
2021-09-30T07:25:09.4100192Z .test.espresso.ViewAction;
2021-09-30T07:25:09.4100742Z ^
2021-09-30T07:25:09.4101571Z /home/vsts/work/1/s/Release/Android/Native/MobileOffline/camera/src/androidTest/java/com/google/android/cameraview/CameraViewTest.java:41: error: class, interface, or enum expected
2021-09-30T07:25:09.4102274Z .test.espresso.IdlingResource;
2021-09-30T07:25:09.4102713Z ^
2021-09-30T07:25:09.4103372Z /home/vsts/work/1/s/Release/Android/Native/MobileOffline/camera/src/androidTest/java/com/google/android/cameraview/CameraViewTest.java:42: error: class, interface, or enum expected
2021-09-30T07:25:09.4104094Z .test.espresso.NoMatchingViewException;
2021-09-30T07:25:09.4104531Z ^
2021-09-30T07:25:09.4105192Z /home/vsts/work/1/s/Release/Android/Native/MobileOffline/camera/src/androidTest/java/com/google/android/cameraview/CameraViewTest.java:43: error: class, interface, or enum expected
2021-09-30T07:25:09.4106262Z .test.espresso.UiController;
2021-09-30T07:25:09.4106691Z ^
2021-09-30T07:25:09.4107390Z /home/vsts/work/1/s/Release/Android/Native/MobileOffline/camera/src/androidTest/java/com/google/android/cameraview/CameraViewTest.java:44: error: class, interface, or enum expected
2021-09-30T07:25:09.4108107Z .test.espresso.ViewAction;
2021-09-30T07:25:09.4108539Z ^
2021-09-30T07:25:09.4109182Z /home/vsts/work/1/s/Release/Android/Native/MobileOffline/camera/src/androidTest/java/com/google/android/cameraview/CameraViewTest.java:45: error: class, interface, or enum expected
2021-09-30T07:25:09.4109878Z .test.espresso.ViewAssertion;
2021-09-30T07:25:09.4110312Z ^
2021-09-30T07:25:09.4110970Z /home/vsts/work/1/s/Release/Android/Native/MobileOffline/camera/src/androidTest/java/com/google/android/cameraview/CameraViewTest.java:46: error: class, interface, or enum expected
2021-09-30T07:25:09.4111652Z .test.filters.FlakyTest;
2021-09-30T07:25:09.4112081Z ^
2021-09-30T07:25:09.4112757Z /home/vsts/work/1/s/Release/Android/Native/MobileOffline/camera/src/androidTest/java/com/google/android/cameraview/CameraViewTest.java:47: error: class, interface, or enum expected
2021-09-30T07:25:09.4113461Z .test.rule.ActivityTestRule;
2021-09-30T07:25:09.4113883Z ^
2021-09-30T07:25:09.4114549Z /home/vsts/work/1/s/Release/Android/Native/MobileOffline/camera/src/androidTest/java/com/google/android/cameraview/CameraViewTest.java:48: error: class, interface, or enum expected
2021-09-30T07:25:09.4115246Z .test.runner.AndroidJUnit4;
2021-09-30T07:25:09.4115660Z ^
2021-09-30T07:25:09.4116068Z 11 errors
2021-09-30T07:25:09.6089909Z 
2021-09-30T07:25:09.6090701Z > Task :crmconfig:processDebugAndroidTestResources
2021-09-30T07:25:09.6090920Z 
2021-09-30T07:25:09.6091183Z FAILURE: Build failed with an exception.
2021-09-30T07:25:09.7090788Z 

Am I not excluding the right file. Plz Help.

Hi @neeraj_kumar_Sahani

This doesn’t seem to be during the SonarQube analysis, is it ?

What happened when you deactivate SonarQube analysis in the Gradle task ? Does it pass ?

Mickaël

yes when i am going with without analysis its not throwing any error. That’s the concern only. Why it is failing when i am adding analysis task.?

Can you share the full log in debug mode please ? That would help to investigate. Let me know if you prefer to send it privately, i can DM you.

Thanks.
Mickaël

It would be better if you can DM me…

1 Like