sonar-runner执行代码分析时编码问题

切换到项目中运行sonar-runner, 会出现如下问题:java

 Exception in thread "main" org.sonar.batch.bootstrapper.BootstrapException: org.
sonar.api.utils.SonarException: Unable to read and import the source file  : 'E:\workspaces\test\src\test\test.java' with the charset : 'UTF-8'.

这实际上是我第二次遇到,第一次遇到后经历艰苦的过程解决了。再次遇到却又忘了,所以有了此文。bootstrap

网上搜到,遇到这种错误有两种状况:api

  1. 由于code的编码格式和sonar-runner配置的不同app

  2. 在相同的命名空间下有相同的名称的文件测试

个人是由于第二种,由于个人项目没有测试代码,但在sonar-project.properties里sonar.tests=src却没有注释掉。故有此错误。编码

相关文章
相关标签/搜索