我有sonaqube服务器和单独的teamcity服务器,我在teamcity配置中添加了一步,在我的css代码库(在bitbucket中)运行sonar runner。
Sonarqube服务器 - Sonarqube 6.7
添加了插件 - sonarqube-6.7 \ extensions \ plugins \ sonar-css-plugin-4.13
我面临与.css文件上的sonarqube扫描相关的问题:
xml
我已经将.css文件的格式从UTF-8更新为UTF-8 BOM,然后这个问题就出现了,但是出现了解析错误问题。那时无法解析,请帮助。
ERROR: Error during Sonar runner execution org.sonar.runner.impl.RunnerException: Unable to execute Sonar Caused by: org.sonar.squidbridge.api.AnalysisException: Unable to analyze file: E:/LocalAgent2/work/fe98ca8c22f54520/SourceCode/UI Design/Source/src/css/components.css
...
Caused by: org.sonar.squidbridge.api.AnalysisException: Unable to analyze file: E:/LocalAgent2/work/fe98ca8c22f54520/SourceCode/UI Design/Source/src/css/components.css
...
Caused by: java.lang.IllegalArgumentException: 17 is not a valid line offset for pointer. File css/components.css has 16 character(s) at line 351
答案 0 :(得分:1)
Resloved: Actual issue was UTF-8 encoding. I tried to run scanner on actual code via cmd prompt with all required parameters available inside "sonar-project.properties" file.
sonar.projectKey=simple-css-scss-less-project
sonar.projectName=Simple CSS / SCSS / Less Project
sonar.projectVersion=1.0
sonar.sources=src
sonar.sourceEncoding=UTF-8
And it was working fine, i am able to see scanned output inside sonar dashboard.
Then I have updated TeamCity configuration. Added build step with Sonar Runner and provided below mentioned parameters.
Project name:
Project key:
Project version:%build.number%
Most important part which resolved my issue --> Additional parameter section i have to add below line.
-Dsonar.sourceEncoding=UTF-8