Sonarqube scan error with line out of range?

元气小坏坏 提交于 2019-11-30 08:28:15

I had the same issue when using sonar maven plugin and jacoco test reports. mvn sonar:sonar relies on an existintig jacoco report, when the source code was changed (lines had been removed), but the test report wasn't updated this error occurred. Running mvn clean test sonar:sonar solved it.

I tried gradle clean buildand it worked for me

For me it was because I had exactly the same class (for example com.test.MyClass) name and package name in two different sub modules (maven), MyClass in first module is larger i.e. 120 lines of code. MyClass in second module is shorter, then the exception was thrown since JaCoCo though the report was for that.

Solution was to rename one of the classes or move it into a different package.

i.e. : com.test.MyClass and com.test.MyClassB

OR:

com.test.MyClass and com.test.foo.MyClass

Same damn issue happens in python code as well. I got it resolved adding a blank line at the end of the file.

If executing a maven clean does not work check if you have any old project folder that needs to be cleaned. Once you remove a submodule from the maven pom it won't remove the folder including the /target directory with the jacoco report from ages ago.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!