Sonarqube configuration help

java

(Mukesh Yadav) #1

Hi,

I am using the sonarqube version is:
`plugins {

id "org.sonarqube" version "2.7"

}`

Sonarqube property configuration is:

`sonarqube {

properties {
    property 'sonar.projectName', "********"
    property 'sonar.sources', "src/main/java"
    property 'sonar.exclusions', "androidTest/**, /androidTest/, src/androidTest/**, /src/androidTest/"
}
androidVariant 'devDebug'

}`

I am trying to exclude the “androidTest” and “test” folder for executing the test because currently, I don’t write any code for the test.

The problem is sonarqube is run every time androidTest why?
Please help how to exclude the androidTest and test folder from sonar execution.


(G Ann Campbell) #2

Hi,

Exclusions are easier to set from the UI.

That said, you might try prefixing your paths with **.

 
Ann


(Mukesh Yadav) #3

Hi,

I tried as well from UI like this

And I also tried this on android gradle file

sonarqube {

properties {
 property 'sonar.projectName', "*******"
    property 'sonar.sources', "src/main/java"
    property 'sonar.exclusions', "androidTest/**, /androidTest/, src/androidTest/**, /src/androidTest/"
}
androidVariant 'devDebug'

}

But when I run a command on the terminal in android studio

./gradlew sonarqube

Then every time they execute androidTest and test folder and return with an error.

SplashActivityTest.java:46: error: cannot find symbol return new TypeSafeMatcher<View>() { ^ symbol: class TypeSafeMatcher location: class SplashActivityTest Note: /home/*****/AndroidStudioProjects/private/****/app/src/androidTest/java/com/*****/android/activities/FetchMyIpActivityTest.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 62 errors


(G Ann Campbell) #4

Hi,

As I mentioned earlier, you probably want to prefix your values with **. I’ve just realized that you’re also missing a file descriptor, such as *.java at the end.

 
Ann


(Mukesh Yadav) #5

Hi,

I have try almost every combination like

property 'sonar.test.exclusions', "**/androidTest/**/*.java, /androidTest/*.java, src/androidTest/**/*.java, /src/androidTest/*.java"

and

property 'sonar.exclusions', "**/androidTest/**/*.java, /androidTest/*.java, src/androidTest/**/*.java, /src/androidTest/*.java"

many cases. Can you please provide a solution. Please!!!. I got stuck.

Thanks in advance.