使用SonarQube进行分析会导致0个文件建立索引并且没有报告(Maven Project) [英] Analysing with SonarQube causes 0 files indexed and no reports (Maven Project)

查看:65
本文介绍了使用SonarQube进行分析会导致0个文件建立索引并且没有报告(Maven Project)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在extern服务器上使用SonarQube时遇到一些麻烦.我现在只和SonarQube合作了几天,当我在本地分析我的Maven项目时,一切正常.我们正在使用Postgresql数据库. 但是,当我尝试在extern SonarQube服务器上分析项目时,会遇到一些问题.

I have some trouble using SonarQube on an extern server. I'm working with SonarQube just for a couple days now and when I analyze my Maven project local everything is working fine. We are using a Postgresql database. But there are some problems when I try to analyze a project on an extern SonarQube server.

我正在使用SonarQube 4.4和Maven 3.3.请在下面找到我的Maven settings.xml.

I'm using SonarQube 4.4 and Maven 3.3. Please find my Maven settings.xml down below.

  <profile>
        <id>sonar</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties> 
            <sonar.jdbc.url>
              jdbc:postgresql://databaseadress/sonarqube?useUnicode=true&amp;characterEncoding=utf8
            </sonar.jdbc.url>
            <sonar.jdbc.username>username</sonar.jdbc.username>
            <sonar.jdbc.password>password</sonar.jdbc.password>                
            <sonar.host.url>
              http://hostAdress
            </sonar.host.url>
        </properties>
    </profile>

我已经添加了正确的数据库连接.我自己安装了SonarQoube服务器,并且声纳正确更改了属性.该项目是用Java编写的. 运行分析,它会连接到数据库并开始进行分析.

I already added the correct database connection. I set up the SonarQoube server by myself and the sonar.propterties was changed correctly.The project is written in Java. Running an analysis it connects to the database and it starts analysing.

如果我使用mvn sonar:sonar分析项目,则会收到以下消息:

If I analyze the project with mvn sonar:sonar I get the following message:

... INFO:SonarQube服务器4.4 [INFO] [17:07:01.958]加载全局设置
[INFO] [17:07:02.137]用户缓存:C:\ Users \ christian.braun.sonar \ cache
[INFO] [17:07:02.142]安装插件
[INFO] [17:07:02.159]安装JDBC驱动程序
[INFO] [17:07:02.163]为jdbc:postgresql://databaseadress
/sonarqube?useUnicode = true& characterEncoding = utf8
创建JDBC数据源 [INFO] [17:07:02.229]初始化Hibernate
[INFO] [17:07:04.077]正在加载技术债务模型...
[INFO] [17:07:04.089]已完成加载技术债务模型:12毫秒
[INFO] [17:07:04.090]加载项目设置
[INFO] [17:07:04.170]应用项目排除项
[INFO] [17:07:04.257] -------------扫描TestMaven
[INFO] [17:07:04.259]加载模块设置
[INFO] [17:07:04.394]加载规则...
[INFO] [17:07:04.403]完成加载规则:9毫秒
[INFO] [17:07:04.415]配置Maven插件
[INFO] [17:07:04.444]与之前的分析进行比较(2014-09-02)
[INFO] [17:07:04.445]比较30天(2014-08-03,2014-09-02 15:58:02.965分析)
[INFO] [17:07:04.446]未配置质量门.
[INFO] [17:07:04.461]基本目录:E:\ WORKSPACE_TEST \ 1
[INFO] [17:07:04.461]工作目录:E:\ WORKSPACE_TEST \ 1 \ target \ sonar
[INFO] [17:07:04.461]源目录:E:\ WORKSPACE_TEST \ 1 \ src \ main \ java
[INFO] [17:07:04.461]测试目录:E:\ WORKSPACE_TEST \ 1 \ src \ test \ java
[INFO] [17:07:04.461]二进制目录:E:\ WORKSPACE_TEST \ 1 \ target \ classes
[INFO] [17:07:04.461]源编码:Windows-1252,默认语言环境:de_DE
[INFO] [17:07:04.461] 索引文件
[INFO] [17:07:04.483] 已索引0个文件
[INFO] [17:07:04.486]传感器QProfileSensor ...
[INFO] [17:07:04.495]传感器QProfileSensor完成:9毫秒
[INFO] [17:07:04.495] Sensor InitialOpenIssuesSensor ...
[INFO] [17:07:04.503]传感器InitialOpenIssuesSensor完成:8毫秒
[INFO] [17:07:04.503]传感器ProjectLinksSensor ...
[INFO] [17:07:04.514]传感器ProjectLinksSensor完成:11毫秒
[INFO] [17:07:04.515] Sensor VersionEventsSensor ...
[INFO] [17:07:04.523]传感器VersionEventsSensor完成:8 ms
[INFO] [17:07:04.523]传感器FileHashSensor ...
[INFO] [17:07:04.524]传感器FileHashSensor完成:1毫秒
[INFO] [17:07:04.524]传感器CpdSensor ...
[INFO] [17:07:04.524]传感器CpdSensor完成:0毫秒
[INFO] [17:07:04.524] Sensor Maven依赖项...
[INFO] [17:07:04.554]传感器Maven依赖关系完成:30 ms
[INFO] [17:07:04.660]执行装饰器...
[INFO] [17:07:04.740]将结果存储在数据库中
[INFO] [17:07:04.782]分析成功,您可以浏览http://hostAdress/dashboard/index/1:1
[INFO] [17:07:04.879]正在执行工作后类org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob
[INFO] [17:07:04.880]正在执行工作后类org.sonar.plugins.core.batch.IndexProjectPostJob
[INFO] [17:07:04.897]正在执行工作后类org.sonar.plugins.dbcleaner.ProjectPurgePostJob
[INFO] [17:07:04.904]->在2014-08-05和2014-09-01之间每天保留一个快照
[INFO] [17:07:04.905]->在2013-09-03至2014-08-05之间每周保留一个快照
[INFO] [17:07:04.905]->在2009-09-08至2013-09-03之间每月保留一个快照
[INFO] [17:07:04.905]->删除以下数据:2009-09-08
[INFO] [17:07:04.908]->清理TestMaven [id = 5]
[INFO] [17:07:04.911]<-清理快照9
[INFO] ----------------------------------------------- -------------------------
[INFO]建立成功
[INFO] ----------------------------------------------- -------------------------
[INFO]总时间:15.234 s
[INFO]完成于:2014-09-02T17:07:04 + 02:00
[INFO]最终内存:14M/76M
[INFO] ----------------------------------------------- -------------------------

... INFO: SonarQube Server 4.4 [INFO] [17:07:01.958] Load global settings
[INFO] [17:07:02.137] User cache: C:\Users\christian.braun.sonar\cache
[INFO] [17:07:02.142] Install plugins
[INFO] [17:07:02.159] Install JDBC driver
[INFO] [17:07:02.163] Create JDBC datasource for jdbc:postgresql://databaseadress
/sonarqube?useUnicode=true&characterEncoding=utf8
[INFO] [17:07:02.229] Initializing Hibernate
[INFO] [17:07:04.077] Loading technical debt model...
[INFO] [17:07:04.089] Loading technical debt model done: 12 ms
[INFO] [17:07:04.090] Load project settings
[INFO] [17:07:04.170] Apply project exclusions
[INFO] [17:07:04.257] ------------- Scan TestMaven
[INFO] [17:07:04.259] Load module settings
[INFO] [17:07:04.394] Loading rules...
[INFO] [17:07:04.403] Loading rules done: 9 ms
[INFO] [17:07:04.415] Configure Maven plugins
[INFO] [17:07:04.444] Compare to previous analysis (2014-09-02)
[INFO] [17:07:04.445] Compare over 30 days (2014-08-03, analysis of 2014-09-02 15:58:02.965)
[INFO] [17:07:04.446] No quality gate is configured.
[INFO] [17:07:04.461] Base dir: E:\WORKSPACE_TEST\1
[INFO] [17:07:04.461] Working dir: E:\WORKSPACE_TEST\1\target\sonar
[INFO] [17:07:04.461] Source dirs: E:\WORKSPACE_TEST\1\src\main\java
[INFO] [17:07:04.461] Test dirs: E:\WORKSPACE_TEST\1\src\test\java
[INFO] [17:07:04.461] Binary dirs: E:\WORKSPACE_TEST\1\target\classes
[INFO] [17:07:04.461] Source encoding: windows-1252, default locale: de_DE
[INFO] [17:07:04.461] Index files
[INFO] [17:07:04.483] 0 files indexed
[INFO] [17:07:04.486] Sensor QProfileSensor...
[INFO] [17:07:04.495] Sensor QProfileSensor done: 9 ms
[INFO] [17:07:04.495] Sensor InitialOpenIssuesSensor...
[INFO] [17:07:04.503] Sensor InitialOpenIssuesSensor done: 8 ms
[INFO] [17:07:04.503] Sensor ProjectLinksSensor...
[INFO] [17:07:04.514] Sensor ProjectLinksSensor done: 11 ms
[INFO] [17:07:04.515] Sensor VersionEventsSensor...
[INFO] [17:07:04.523] Sensor VersionEventsSensor done: 8 ms
[INFO] [17:07:04.523] Sensor FileHashSensor...
[INFO] [17:07:04.524] Sensor FileHashSensor done: 1 ms
[INFO] [17:07:04.524] Sensor CpdSensor...
[INFO] [17:07:04.524] Sensor CpdSensor done: 0 ms
[INFO] [17:07:04.524] Sensor Maven dependencies...
[INFO] [17:07:04.554] Sensor Maven dependencies done: 30 ms
[INFO] [17:07:04.660] Execute decorators...
[INFO] [17:07:04.740] Store results in database
[INFO] [17:07:04.782] ANALYSIS SUCCESSFUL, you can browse http://hostAdress/dashboard/index/1:1
[INFO] [17:07:04.879] Executing post-job class org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob
[INFO] [17:07:04.880] Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob
[INFO] [17:07:04.897] Executing post-job class org.sonar.plugins.dbcleaner.ProjectPurgePostJob
[INFO] [17:07:04.904] -> Keep one snapshot per day between 2014-08-05 and 2014-09-01
[INFO] [17:07:04.905] -> Keep one snapshot per week between 2013-09-03 and 2014-08-05
[INFO] [17:07:04.905] -> Keep one snapshot per month between 2009-09-08 and 2013-09-03
[INFO] [17:07:04.905] -> Delete data prior to: 2009-09-08
[INFO] [17:07:04.908] -> Clean TestMaven [id=5]
[INFO] [17:07:04.911] <- Clean snapshot 9
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.234 s
[INFO] Finished at: 2014-09-02T17:07:04+02:00
[INFO] Final Memory: 14M/76M
[INFO] ------------------------------------------------------------------------

一见钟情,但Sonar找不到任何文件.已索引0个文件 看看SonarQube时,我发现了项目文件夹,但是没有报告.

Looks good at first sight but Sonar doesn't find any files. 0 files indexed When I take a look at SonarQube I discover the project folder but there are no reports.

Sonar无法为任何文件编制索引可能是什么问题? 我读到,缺少声纳运行器可能会出现此问题,但是SonarQube文档说,使用Maven-Plugin时不需要Sonar-Runner. 为了清楚起见,该项目与sonarqube不在同一个mashine上.这对索引文件有关系吗? 请认为我是SonarQube的新手

What could be the problem that Sonar doesn't index any files? I read that this problem could go with the missing sonar-runner, but the SonarQube Documentation says that there is no need of the Sonar-Runner while using the Maven-Plugin. Just to make this clear, the project is not on the same mashine as sonarqube. Does this matter for indexing files? Please consider that I'm a complete newbie to SonarQube

最诚挚的问候

基督徒

推荐答案

所以我解决了这个问题. SonarQube只是缺少所需的插件.我不必在我的本地主机上使用SonarQube来执行此操作.通过settings->Update Center安装它们之后,一切正常.就像我说的那样,这是一个新手错误.

So i fixed the problem. SonarQube was just missing the needed plugins. I didn't had to do that using SonarQube on my localhost. After installing them through settings->Update Center everything worked fine. As I said this was a greenhorn mistake.

这篇关于使用SonarQube进行分析会导致0个文件建立索引并且没有报告(Maven Project)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆