Sonartask failing while encountering same :sub-sub-Project Name in different folders


(Prashant Mahajan) #1

We are trying to move from sonarRunner to “sonarqube-gradle-plugin”, “version”: "2.0.1"
Thereafter we encountered below error :

:sonarqube FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:sonarqube’.

Can not add twice the same measure on org.sonar.api.resources.Project@7ecf4df2[id=2420842,,qualifier=BRC]: org.sonar.api.measures.Measure@38b9179[id=,metricKey=profile,metric=Metric[id=10148,formula=,key=profile,description=Selected quality profile,type=DATA,direction=0,domain=General,name=Profile,qualitative=false,userManaged=false,enabled=true,origin=JAV,worstValue=,bestValue=,optimizedBestValue=false,hidden=false,deleteHistoricalData=false],value=10060.0,data=EMaaS Profile,description=,alertStatus=,alertText=,tendency=,date=,variation1=,variation2=,variation3=,variation4=,variation5=,url=,characteristic=,requirement=,personId=,persistenceMode=FULL]

  • Try:
    Run with --info or --debug option to get more log output.

What I was able to narrow down was that dbmsconfig folder which is present in 2 locations at sub-sub-Module level is causing the trouble.
Because of this during the runtime on the 2nd occurance Base dir:, Working dir: , Source dirs: , Binary dirs: are getting incorrectly set.
Below link talks about the way projectKey / ModuleKey are set

Wasn’t encountering this problem with SonarRunner.Please guide the possible solution to this problem.

(Prashant Mahajan) #2

The modulekey for a sub project should associate with parent project in order to differentiate between the sub projects.
Added the below code in build.gradle of repository in order to generate correct module key

allprojects { = publishGroup
if (project != rootProject) { += project.path.replaceAll(~/:/, ‘.’)
Now the build is working fine.