We am working on splitting out our gradle build for a multi module gradle project. Previously we used to build the whole repo together using a build.gradle at the top level and sonarqube works fine but now we want to build submodules in the repo with their own build.gradle files. The issue we are hitting is with integrating sonarqube for submodules.
When I am keeping sonarqube property in top level and nested level build.gradle, I am hitting this error:
File abc/src/main/java/abc.java can’t be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
When I removed sonarqube property from the top level and only having it at the nested level, I am getting this error:
sonarqubeSonarQube server [http://localhost:9000] can not be reached
even though sonar.host.url is specified in nested level build.gradle
I am trying to build my submodule with this command:
gradle build sonarqube -Dsonar.login=USERNAME -Dsonar.password=PASSWORD -Dsonar.branch.name=test -Dsonar.projectVersion=test -Dsonar.sources=abc/src/main/java
project: build.gradle abc/: build.gradle src/main/java ..... xyz/: build.gradle src/main/java .....
Can someone please help me in setting sonarqube correctly for our submodule builds?