SonarQube扫描运行但未生成任何结果

问题描述

我第一次运行SonarQube扫描。这是CE版本8.3.1。

我在192.168.56.111的服务器上运行了SQ。我的开发工作站在192.168.0.11上。没有网络问题。

由于我是SQ的新手,所以我尝试使其保持尽可能的基本。我在https://github.com/SonarSource/sonar-scanning-examples/blob/master/sonarqube-scanner-maven/maven-basic/src/main/java/com/acme/basic/

中使用示例HelloWorld。

我没有使用Git。只需将HelloWorld项目保存到本地硬盘中

源代码位于/ opt / workspace / eclipse / java / my-app / src / main / java / com / mycompany / app /

扫描仪位于/opt/sonarqube/scanner/sonar-scanner-4.4.0.2170-linux/bin

这是属性文件的副本。无论是否将其放在扫描仪的conf目录或应用程序工作区中,我都使用相同的文件……我看到了不同的网页,它们都出现在任一位置:

sonar.host.url=http://192.168.56.111:9000

sonar.sourceEncoding=UTF-8

sonar.projectKey=com.mycompany.app:my-app

sonar.scm.disabled=True

sonar.sources=/opt/workspace/eclipse/java/my-app/src/main/java/com/mycompany/app

sonar.login=73a9a7ab66a335d0d83aee813d576e184934a336

当我运行声纳扫描仪然后检查结果时,姓名|概述,其中显示“主分支没有代码行”。

问题#1:如果sonar.scm.disabled = true位于props文件中,那么如何发生此错误?我还进入了SQ服务器中的项目设置,并在那里也禁用了SCM传感器。结果相同。

问题2:我在终端输出中注意到,它说.java文件被忽略。因此,我将sonar.sources属性更改为类文件位于的位置:/ opt / workspace / eclipse / java / my-app / target / classes / com / mycompany / app /。结果相同。 sonar.sources属性应该是什么? SQ对Java文件或类文件有效吗?

结果显示“没有问题。哇!”因此,我在HelloWorld类的sayHello方法中添加了这个但很丑陋的方法:

KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
kpg.initialize(1024);

问题3:仍然没有代码问题。 SQ应该标明1024(小于2048)的大小对吧?

====编辑8月23日====

根据@HernánAlarcón的评论从终端添加输出。

INFO: Scanner configuration file: /opt/sonarqube/scanner/sonar-scanner-4.4.0.2170-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.4.0.2170
INFO: Java 11.0.3 AdoptOpenJDK (64-bit)
INFO: Linux 3.10.0-1127.10.1.el7.x86_64 amd64
INFO: User cache: /home/dogzilla/.sonar/cache
INFO: Scanner configuration file: /opt/sonarqube/scanner/sonar-scanner-4.4.0.2170-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarQube server 8.3.1
INFO: Default locale: "en_US",source code encoding: "UTF-8"
INFO: Load global settings
INFO: Load global settings (done) | time=69ms
INFO: Server id: A7EE8CF2-AXMiwj91ZEnoz7IhXD_G
INFO: User cache: /home/dogzilla/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=36ms
INFO: Load/download plugins (done) | time=86ms
INFO: Process project properties
INFO: Process project properties (done) | time=7ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=3ms
INFO: Project key: com.mycompany.app:my-app
INFO: Base dir: /opt/workspace/eclipse/java/my-app/target/classes/com/mycompany/app
INFO: Working dir: /opt/workspace/eclipse/java/my-app/target/classes/com/mycompany/app/.scannerwork
INFO: Load project settings for component key: 'com.mycompany.app:my-app'
INFO: Load project settings for component key: 'com.mycompany.app:my-app' (done) | time=17ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=40ms
INFO: Load active rules
INFO: Load active rules (done) | time=851ms
INFO: Indexing files...
INFO: Project configuration:
WARN: File '/opt/workspace/eclipse/java/my-app/src/main/java/com/mycompany/app/HelloWorld.java' is ignored. It is not located in project basedir '/opt/workspace/eclipse/java/my-app/target/classes/com/mycompany/app'.
WARN: File '/opt/workspace/eclipse/java/my-app/src/main/java/com/mycompany/app/AppRunner.java' is ignored. It is not located in project basedir '/opt/workspace/eclipse/java/my-app/target/classes/com/mycompany/app'.
WARN: File '/opt/workspace/eclipse/java/my-app/src/main/java/com/mycompany/app/sonar-scanner.properties' is ignored. It is not located in project basedir '/opt/workspace/eclipse/java/my-app/target/classes/com/mycompany/app'.
INFO: 0 files indexed
INFO: ------------- Run sensors on module com.mycompany.app:my-app
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=38ms
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/home/dogzilla/.sonar/cache/54f6535c111cefad0fb6a09ba3e61922/sonar-javascript-plugin.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
INFO: Sensor SonarCSS Rules [cssfamily]
INFO: No CSS,PHP,HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=1ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported,no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=3ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=0ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=0ms
INFO: SCM Publisher is disabled
INFO: CPD Executor Calculating CPD for 0 files
INFO: CPD Executor CPD calculation finished (done) | time=0ms
INFO: Analysis report generated in 70ms,dir size=77 KB
INFO: Analysis report compressed in 12ms,zip size=9 KB
INFO: Analysis report uploaded in 35ms
INFO: ANALYSIS SUCCESSFUL,you can browse http://192.168.56.111:9000/dashboard?id=com.mycompany.app%3Amy-app
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://192.168.56.111:9000/api/ce/task?id=AXQeYMFVCyJo7mZCTWSk
INFO: Analysis total time: 2.802 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 3.561s
INFO: Final Memory: 6M/37M
INFO: ------------------------------------------------------------------------

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...