SonarQube: Source is not present in module base di

2019-09-09 22:34发布

问题:

We have been executing sonar analysis successfully with SQ-4.5.4 version with no issues. Suddenly since couple days our sonar analysis build is failing with below error message:

It is not indexing any source file even though it has found them. We have made no changes in our pom.xml or project structure. I am not sure why it is adding "build/sonar" to base directory path that I have mentioned in pom.xml for project base directory. I tried giving relative path too but still issue is reproducible.

[INFO] [14:03:23.298] Base dir: /opt/customer/ci_workspace/sonar/10.1.0/TN/build/sonar
[INFO] [14:03:23.302] Source encoding: ISO-8859-1, default locale: en_US
[INFO] [14:03:23.304] Index files
[WARN] [14:03:24.008] File '/opt/customer/ci_workspace/sonar/10.1.0/TN/access/Application/src/com/panther/ph/access/persistence/cocobase/AccessBP.java' is ignored. It is not located in module basedir '/opt/customer/ci_workspace/sonar/10.1.0/TN/build/sonar'.

I have mentioned below property in my pom.xml

"/opt/customer/ci_workspace/sonar/10.1.0/TN ../../access/Application/src"

回答1:

The base directory is where your POM is located and your analysis launched.

The problem is that in the POM, you are referring to a source folder that is not located in a sub-folder of the base directory. This is not supported in SonarQube - and this is actually not a standard structure for source code.



回答2:

@Fabrice: The issue was someone had made some changes in repository which made our sonar-maven-plugin degrade to 2.0 version from 2.6 due to which it has failed.

@Everyone: If you are facing similar issue please check your sonar-maven-plugin is at least 2.6 version.



标签: sonarqube