mvn声纳:声纳不生成仪表板数据

时间:2013-08-08 18:35:36

标签: maven sonarqube

我们使用maven来构建我们的项目。

我实施了http://docs.codehaus.org/display/SONAR/Installing+and+Configuring+Maven中提到的配置,使用声纳分析项目。

我的.m2/settings.xml

的快照
<profiles>
    <profile>
        <id>sonar</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <sonar.jdbc.url>jdbc:oracle:thin:@10.207.67.95/XE</sonar.jdbc.url>
            <sonar.jdbc.username>sonarqube</sonar.jdbc.username>
            <sonar.jdbc.password>sonarqube</sonar.jdbc.password>
            <sonar.jdbc.driver>oracle.jdbc.OracleDriver</sonar.jdbc.driver>
            <sonar.host.url>http://localhost:9000</sonar.host.url>
        </properties>
    </profile>
</profiles>
<activeProfiles>
    <activeProfile>artifactory</activeProfile>
    <activeProfile>sonar</activeProfile>
</activeProfiles>

当我从包含mvn sonar:sonar的目录中运行pom.xml时,它会显示构建成功。

我检查了仪表板,项目显示,显示的LOC为空。 仪表板没有问题。

mvn sonar:sonar

的输出
[INFO] ------------------------------------------------------------------------
[INFO] Building xxxx 2.2.0.29-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- sonar-maven-plugin:2.0:sonar (default-cli) @ xxxx ---
[INFO] Sonar version: 3.6.2
[INFO] [15:18:16.984] Load batch settings
[INFO] [15:18:17.043] User cache: /home/jsaluja/.sonar/cache
[INFO] [15:18:17.048] Install plugins
[INFO] [15:18:17.589] Install JDBC driver
[INFO] [15:18:17.596] Create JDBC datasource for jdbc:oracle:thin:@10.207.67.95/XE
[INFO] [15:18:19.296] Initializing Hibernate
[INFO] [15:18:21.830] Load project settings
[INFO] [15:18:21.858] Apply project exclusions
[INFO] [15:18:22.003] -------------  Scan xxxx
[INFO] [15:18:22.008] Load module settings
[INFO] [15:18:22.607] Quality profile : [name=Sonar way,language=java]
[INFO] [15:18:22.625] Excluded tests: 
[INFO] [15:18:22.625]   **/package-info.java
[INFO] [15:18:22.660] Configure Maven plugins
[INFO] [15:18:22.728] Compare to previous analysis (2013-08-08)
[INFO] [15:18:22.750] Compare over 5 days (2013-08-03, analysis of 2013-08-07 12:55:06.0)
[INFO] [15:18:22.763] Compare over 30 days (2013-07-09, analysis of 2013-08-07 12:55:06.0)
[INFO] [15:18:22.890] Base dir: /home/jsaluja/0801/frontend/yyyy/xxxx
[INFO] [15:18:22.890] Working dir: /home/jsaluja/0801/frontend/yyyy/xxxx/target/sonar
[INFO] [15:18:22.890] Binary dirs: /home/jsaluja/0801/frontend/yyyy/xxxx/target/classes
[INFO] [15:18:22.890] Source encoding: UTF-8, default locale: en_US
[INFO] [15:18:22.894] Sensor JavaSourceImporter...
[INFO] [15:18:22.894] Sensor JavaSourceImporter done: 0 ms
[INFO] [15:18:22.894] Sensor JavaSquidSensor...
[INFO] [15:18:22.894] Sensor JavaSquidSensor done: 0 ms
[INFO] [15:18:22.894] Sensor SurefireSensor...
[INFO] [15:18:22.895] parsing /home/jsaluja/0801/frontend/yyyy/xxxx/target/surefire-reports
[INFO] [15:18:22.898] Sensor SurefireSensor done: 4 ms
[INFO] [15:18:22.898] Sensor CpdSensor...
[INFO] [15:18:22.898] SonarEngine is used
[INFO] [15:18:22.898] Sensor CpdSensor done: 0 ms
[INFO] [15:18:22.898] Sensor InitialOpenIssuesSensor...
[INFO] [15:18:22.901] Sensor InitialOpenIssuesSensor done: 3 ms
[INFO] [15:18:22.901] Sensor ProfileSensor...
[INFO] [15:18:23.209] Sensor ProfileSensor done: 308 ms
[INFO] [15:18:23.209] Sensor ProfileEventsSensor...
[INFO] [15:18:23.236] Sensor ProfileEventsSensor done: 27 ms
[INFO] [15:18:23.236] Sensor ProjectLinksSensor...
[INFO] [15:18:23.241] Sensor ProjectLinksSensor done: 5 ms
[INFO] [15:18:23.241] Sensor VersionEventsSensor...
[INFO] [15:18:23.253] Sensor VersionEventsSensor done: 12 ms
[INFO] [15:18:23.253] Sensor Maven dependencies...
[INFO] [15:18:23.805] Sensor Maven dependencies done: 552 ms
[INFO] [15:18:23.805] Sensor JaCoCoSensor...
[INFO] [15:18:23.809] Project coverage is set to 0% since there is no directories with classes.
[INFO] [15:18:23.809] Sensor JaCoCoSensor done: 4 ms
[INFO] [15:18:24.112] Execute decorators...
[INFO] [15:18:24.287] Store results in database
[INFO] [15:18:24.336] ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/a.b.c.d.e:xxxx
[INFO] [15:18:24.337] Executing post-job class org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob
[INFO] [15:18:24.337] Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob
[INFO] [15:18:24.387] Executing post-job class org.sonar.plugins.dbcleaner.ProjectPurgePostJob
[INFO] [15:18:24.398] -> Keep one snapshot per day between 2013-07-11 and 2013-08-07
[INFO] [15:18:24.400] -> Keep one snapshot per week between 2012-08-09 and 2013-07-11
[INFO] [15:18:24.401] -> Keep one snapshot per month between 2008-08-14 and 2012-08-09
[INFO] [15:18:24.402] -> Delete data prior to: 2008-08-14
[INFO] [15:18:24.404] -> Clean xxxx [id=10080]
[INFO] [15:18:24.409] <- Clean snapshot 13758
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.637s
[INFO] Finished at: Thu Aug 08 15:18:24 EDT 2013
[INFO] Final Memory: 19M/277M

我可以使用sonar-project.properties从同一目录独立运行声纳跑步者,并且仪表板显示数据,以及一系列问题。

声纳跑步者的输出:

 ~/sonar-runner-2.3/bin/sonar-runner 
SonarQube Runner 2.3
Java 1.6.0_21 Sun Microsystems Inc. (64-bit)
Linux 2.6.18-238.5.1.el5 amd64
INFO: Runner configuration file: /home/jsaluja/sonar-runner-2.3/conf/sonar-runner.properties
INFO: Project configuration file: /home/jsaluja/0801/frontend/yyyy/xxxx/sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: /home/jsaluja/0801/frontend/yyyy/xxxx/.sonar
INFO: SonarQube Server 3.6.2
15:19:14.377 INFO  - Load batch settings
15:19:14.440 INFO  - User cache: /home/jsaluja/.sonar/cache
15:19:14.444 INFO  - Install plugins
15:19:14.944 INFO  - Install JDBC driver
15:19:14.952 INFO  - Create JDBC datasource for jdbc:oracle:thin:@10.207.67.95/XE
15:19:16.300 INFO  - Initializing Hibernate
15:19:18.517 INFO  - Load project settings
15:19:18.548 INFO  - Apply project exclusions
15:19:18.682 INFO  - -------------  Scan xxxx
15:19:18.688 INFO  - Load module settings
15:19:19.295 INFO  - Quality profile : [name=Sonar way,language=java]
15:19:19.314 INFO  - Excluded tests: 
15:19:19.314 INFO  -   **/package-info.java
15:19:19.355 INFO  - Configure Maven plugins
15:19:19.439 INFO  - Compare to previous analysis (2013-08-08)
15:19:19.463 INFO  - Compare over 5 days (2013-08-03, analysis of 2013-08-08 14:38:22.472)
15:19:19.478 INFO  - Compare over 30 days (2013-07-09, analysis of 2013-08-08 14:38:22.472)
15:19:19.647 INFO  - Base dir: /home/jsaluja/0801/frontend/yyyy/xxxx
15:19:19.647 INFO  - Working dir: /home/jsaluja/0801/frontend/yyyy/xxxx/.sonar
15:19:19.648 INFO  - Source dirs: /home/jsaluja/0801/frontend/yyyy/xxxx/src
15:19:19.648 INFO  - Source encoding: UTF-8, default locale: en_US
15:19:19.691 INFO  - Sensor JavaSourceImporter...
15:19:20.048 INFO  - Sensor JavaSourceImporter done: 357 ms
15:19:20.048 INFO  - Sensor JavaSquidSensor...
15:19:20.115 INFO  - Java AST scan...
15:19:22.213 INFO  - Java AST scan done: 2098 ms
15:19:22.354 INFO  - Sensor JavaSquidSensor done: 2306 ms
15:19:22.354 INFO  - Sensor SurefireSensor...
15:19:22.355 INFO  - parsing /home/jsaluja/0801/frontend/yyyy/xxxx/.sonar/build/surefire-reports
15:19:22.355 INFO  - Sensor SurefireSensor done: 1 ms
15:19:22.355 INFO  - Sensor CpdSensor...
15:19:22.355 INFO  - SonarEngine is used
15:19:22.360 INFO  - Cross-project analysis disabled
15:19:22.635 INFO  - Sensor CpdSensor done: 280 ms
15:19:22.636 INFO  - Sensor CheckstyleSensor...
15:19:22.637 INFO  - Execute Checkstyle 5.6...
15:19:22.648 INFO  - Checkstyle configuration: /home/jsaluja/0801/frontend/yyyy/xxxx/.sonar/checkstyle.xml
15:19:23.990 INFO  - Execute Checkstyle 5.6 done: 1353 ms
15:19:24.001 INFO  - Sensor CheckstyleSensor done: 1365 ms
15:19:24.001 INFO  - Sensor PmdSensor...
15:19:24.004 INFO  - Execute PMD 4.3...
15:19:24.024 INFO  - Java version: 1.5
15:19:24.066 INFO  - PMD configuration: /home/jsaluja/0801/frontend/yyyy/xxxx/.sonar/pmd.xml
15:19:27.017 INFO  - Execute PMD 4.3 done: 3013 ms
15:19:27.110 INFO  - Sensor PmdSensor done: 3109 ms
15:19:27.110 INFO  - Sensor InitialOpenIssuesSensor...
15:19:27.363 INFO  - Sensor InitialOpenIssuesSensor done: 253 ms
15:19:27.363 INFO  - Sensor ProfileSensor...
15:19:27.638 INFO  - Sensor ProfileSensor done: 275 ms
15:19:27.638 INFO  - Sensor ProfileEventsSensor...
15:19:27.654 INFO  - Sensor ProfileEventsSensor done: 16 ms
15:19:27.655 INFO  - Sensor ProjectLinksSensor...
15:19:27.660 INFO  - Sensor ProjectLinksSensor done: 5 ms
15:19:27.660 INFO  - Sensor VersionEventsSensor...
15:19:27.674 INFO  - Sensor VersionEventsSensor done: 14 ms
15:19:27.674 INFO  - Sensor JaCoCoSensor...
15:19:27.677 INFO  - Project coverage is set to 0% since there is no directories with classes.
15:19:27.677 INFO  - Sensor JaCoCoSensor done: 3 ms
15:19:28.164 INFO  - Execute decorators...
15:19:31.041 INFO  - Store results in database
15:19:31.214 INFO  - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/a.b.c.d.xxxx
15:19:31.216 INFO  - Executing post-job class org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob
15:19:31.230 INFO  - Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob
15:19:31.279 INFO  - Executing post-job class org.sonar.plugins.dbcleaner.ProjectPurgePostJob
15:19:31.288 INFO  - -> Keep one snapshot per day between 2013-07-11 and 2013-08-07
15:19:31.289 INFO  - -> Keep one snapshot per week between 2012-08-09 and 2013-07-11
15:19:31.289 INFO  - -> Keep one snapshot per month between 2008-08-14 and 2012-08-09
15:19:31.289 INFO  - -> Delete data prior to: 2008-08-14
15:19:31.292 INFO  - -> Clean xxxx [id=11882]
15:19:31.296 INFO  - <- Clean snapshot 13716
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
Total time: 17.946s
Final Memory: 20M/732M
INFO: --------------------------------------------

为同一个项目执行的mvn和sonar runner的仪表板屏幕截图

https://docs.google.com/file/d/0B2TK6N3XnvavRmdrX0ZYb2V3Q0k/edit?usp=sharing

红色显示mvn的输出 - 没有LOC 绿色显示声纳转轮的输出 - LOC和发现的问题

mvn配置缺少什么?

1 个答案:

答案 0 :(得分:1)

似乎声纳没有找到任何类文件

15:19:27.677 INFO  - Project coverage is set to 0% since there is no directories with classes.

你跑了吗

mvn clean install -DskipTests
<{1>} mvn sonar:sonar之前的recommendedmvn sonar:sonar将不再编译源代码(我想自声纳3.6)。