无法执行 Findbugs 原因:该项目包含未编译的 Java 源文件 [英] Can not execute Findbugs Caused by: This project contains Java source files that are not compiled
问题描述
我目前正在使用带有扫描仪 2.6.1 的 sonarqube 服务器 5.6,并且在分析 java 项目期间不断出现错误.它似乎抱怨一些未在二进制文件夹中编译的 java 文件(二进制文件夹中根本没有任何文件).添加 -X 参数后,我会得到更多异常(标记为已忽略),请参见下文.有什么线索吗?
I am currently using the sonarqube server 5.6 with scanner 2.6.1 and I keep getting errors during analysis for a java project. It appears to complain about some java files not compiled in the binaries folder (there aren't any at all in the binaries folder). Once I add the -X parameter I get more exceptions (flagged as ignored), see below. any clues?
sonar-project.properties 后跟日志
sonar-project.properties followed by logs
sonar.projectKey=myproj
sonar.projectName=myproj
sonar.projectVersion=1.1
sonar.branch=1.1
sonar.sources=./java
sonar.binaries=./deploy
sonar.log.level=DEBUG
sonar.verbose=false
sonar.sourceEncoding=UTF-8
INFO: Execute Checkstyle 6.12.1 done: 2365 ms
INFO: Sensor CheckstyleSensor (done) | time=2377ms
INFO: Sensor SCM Sensor (wrapped)
INFO: SCM provider for this project is: svn
INFO: 9 files to be analyzed
DEBUG: Working directory: D:Appsxxxx
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
INFO: 9/9 files analyzed
INFO: Sensor SCM Sensor (wrapped) (done) | time=3289ms
INFO: Sensor FindBugs Sensor (wrapped)
WARN: Findbugs needs sources to be compiled. Please build project before
executing sonar or check the location of compiled classes to make it possible for Findbugs to analyse your project.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
<小时>
不带 -e 参数的执行
execution without the -e param
警告:Findbugs 需要编译源代码.请在执行声纳之前构建项目或检查已编译类的位置,以便 Findb 分析您的项目.然后java.lang.IllegalStateException: 无法执行 Findbugs
WARN: Findbugs needs sources to be compiled. Please build project before executing sonar or check the location of compiled classes to make it possible for Findbto analyse your project. then java.lang.IllegalStateException: Can not execute Findbugs
原因:java.lang.IllegalStateException:此项目包含未编译的 Java 源文件.在 org.sonar.plugins.findbugs.FindbugsConfiguration.getFindbugsProject(FindbugsConfiguration.java:120)在 org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.
Caused by: java.lang.IllegalStateException: This project contains Java source files that are not compiled. at org.sonar.plugins.findbugs.FindbugsConfiguration.getFindbugsProject(FindbugsConfiguration.java:120) at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.
使用 -X 参数
com.puppycrawl.tools.checkstyle.api.CheckstyleException:SuppressionCommentFilter 中缺少键严重性"
com.puppycrawl.tools.checkstyle.api.CheckstyleException: missing key 'severity' in SuppressionCommentFilter
然后是多个异常DEBUG:继续寻找,忽略异常com.puppycrawl.tools.checkstyle.api.CheckstyleException:无法找到 com.puppycrawl.tools.checkstyle.checks.sizes.WhitespaceAroundCheck 的类
then multiple exceptions DEBUG: Keep looking, ignoring exception com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to find class for com.puppycrawl.tools.checkstyle.checks.sizes.WhitespaceAroundCheck
那么警告:Findbugs 需要编译源代码.请在执行声纳之前构建项目或检查已编译类的位置以使其成为可能然后信息:执行失败
then WARN: Findbugs needs sources to be compiled. Please build project before executing sonar or check the location of compiled classes to make it possible for then INFO: EXECUTION FAILURE
推荐答案
定义后对我有用:
sonar.java.binaries=[YOUR_BUILD_DIR] (target/classes)
见于:
https://github.com/SonarQubeCommunity/sonar-findbugs/issues/49
这篇关于无法执行 Findbugs 原因:该项目包含未编译的 Java 源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!