Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SonarQube扫描运行但不运行’;我不能产生任何结果_Sonarqube_Static Analysis_Sonarqube Scan_Software Quality - Fatal编程技术网

SonarQube扫描运行但不运行’;我不能产生任何结果

SonarQube扫描运行但不运行’;我不能产生任何结果,sonarqube,static-analysis,sonarqube-scan,software-quality,Sonarqube,Static Analysis,Sonarqube Scan,Software Quality,我第一次做了声纳扫描。这是CE版本,8.3.1 我在192.168.56.111的服务器上运行SQ。我的开发工作站是192.168.0.11。没有网络问题 因为我是SQ的新手,所以我尽量保持它的基础性。我正在使用中的HelloWorld示例 我没有使用Git。只需将HelloWorld项目保存到本地硬盘 源代码位于/opt/workspace/eclipse/java/my-app/src/main/java/com/mycompany/app/ 扫描仪位于/opt/sonarqube/scan

我第一次做了声纳扫描。这是CE版本,8.3.1

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

因为我是SQ的新手,所以我尽量保持它的基础性。我正在使用中的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:如果props文件中有sonar.scm.disabled=True,那么该错误是如何发生的?我还转到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,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: ------------------------------------------------------------------------

你能告诉我们你是如何运行扫描仪的,它的输出是什么吗?@HernánAlarcón会做的。。。用这些信息编辑原始帖子。可以解决你的问题吗?可以。我将sonar.projectBaseDir添加到属性文件中,而不是sonar.sources,它可以完美地工作。谢谢好的@HernánAlarcón,我怎么才能相信你的回答?你的回复是评论而不是帖子?