Android project with git submodule configuration

Hi,

I’m trying to setup sonarqube on jenkins for my android project with a submodule, but I’m not able to since I’m getting this error:

[ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ‘:sonarqube’.
[ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Dir <…Android_Develop/ws/submodule/lib/src/main> should be relative to project baseDir

I’ve tried so many projectBaseDir paths that I don’t know what I’am doing wrong.

Project structure
/mobile-android/app/myapp/src/main
/mobile-android/submodule/lib/src/main

build.gradle (root)
plugins {
id “org.sonarqube” version “2.7”
}

sonarqube {
properties {
property ‘sonar.projectName’, ‘My app’
property ‘sonar.import_unknown_files’, true
property ‘sonar.java.source’, 1.8
property ‘sonar.modules’, ‘:lib’
}
}

build.gradle (myapp)
sonarqube {
properties {
property ‘sonar.projectKey’, ‘myproject.sonarqube:android:myapp’
}
}

build.gradle (lib)
sonarqube {
properties {
property ‘sonar.projectKey’, ‘myproject.sonarqube:android:lib’
property ‘sonar.projectBaseDir’, ‘…/submodule/lib’
}
}

settings.gradle
include ‘:myapp’
include ‘:lib’
project(’:lib’).projectDir = new File(settingsDir, ‘…/submodule/lib’)

Thanks,
Diogo.

1 Like

anyone?

Hi,

What is your SQ version?
FYI modules are dropped since SQ 7.6.

I noticed that in the root sonar.modules has only one module. Do you want to have 2?

Why are you setting sonar.projectBaseDir everywhere?

I suggest you to try to simplify configuration, update SQ and show full debug logs of analysis.

Regards,
Elena

Hi Elena,

We are using v7.1
I don’t know if the app counts as a submodule, but I’m assuming not, since if i add skipProject to the build.gradle (lib) the sonarqube runs just fine.
And I’m only settings the projectBaseDir for the lib, since the lib folder is not inside the app directory. I don’t know if this is right, but I think is not since is not working.

Thanks,
Diogo.