Android project with git submodule configuration

android

(Diogo Mestre) #1

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.