2016-06-09 68 views
0

我有Maven Java项目的JUnit XML报告,而不是源文件。 我希望Sonarqube 4.5.7通过执行以下命令发布这些报告:“mvn sonar:sonar”。在Sonar上发布JUnit测试报告

Sonarqube安装在远程服务器上,安装了java-plugin-3.8和其他插件。

我所有的JUnit XML报告都位于名为“reports”的目录中。

我谟的根pom.xml中看起来是这样的:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>***</groupId> 
    <artifactId>***</artifactId> 
    <version>1.0.0</version> 
    <packaging>pom</packaging> 
    <name>MEDIATION-DEV1_SMED-Apporteur</name> 
    <properties> 
    <sonar.junit.reportsPath>reports</sonar.junit.reportsPath> 
    <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis> 
    <sonar.jdbc.username>***</sonar.jdbc.username> 
    <sonar.jdbc.password>***</sonar.jdbc.password> 
    <sonar.jdbc.url>jdbc:mysql://***useUnicode=true&amp;characterEncoding=utf8</sonar.jdbc.url> 
    <sonar.language>java</sonar.language> 
    <sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver> 
    <sonar.jdbc.dialect>mysql</sonar.jdbc.dialect> 
    <sonar.host.url>***</sonar.host.url> 
    </properties> 
</project> 

当我执行“MVN声纳:声纳”我得到:

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 
[INFO] Scanning for projects... 
[INFO] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building *** 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Apporteur --- 
[INFO] Deleting E:\jenkins-slave\workspace\workspace\Mediation-Sonar-Test-Alex\target 
[INFO] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building *** 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- sonar-maven-plugin:3.0.2:sonar (default-cli) @ Apporteur --- 
[INFO] User cache: C:\Users\S046499\.sonar\cache 
[INFO] SonarQube version: 4.5.7 
[INFO] Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent) 
[INFO] [14:01:41.624] Load global referentials... 
[INFO] [14:01:41.861] Load global referentials done: 241 ms 
[INFO] [14:01:41.888] User cache: C:\Users\S046499\.sonar\cache 
[INFO] [14:01:41.904] Install plugins 
[INFO] [14:01:42.141] Install JDBC driver 
[INFO] [14:01:42.161] Create JDBC datasource for jdbc:*** useUnicode=true&characterEncoding=utf8 
[INFO] [14:01:43.969] Initializing Hibernate 
[INFO] [14:01:47.254] views plugin licensed to ***, EVALUATION [Expiration: 2016-06-17, Server: *] 
[INFO] [14:01:47.560] Load project referentials... 
[INFO] [14:01:48.253] Load project referentials done: 693 ms 
[INFO] [14:01:48.255] Load project settings 
[INFO] [14:01:48.837] Loading technical debt model... 
[INFO] [14:01:48.889] Loading technical debt model done: 52 ms 
[INFO] [14:01:48.895] Apply project exclusions 
[WARN] [14:01:49.305] 'sonar.dynamicAnalysis' is deprecated since version 4.3 and should no longer be used. 
[INFO] [14:01:49.408] ------------- Scan *** 
[INFO] [14:01:49.421] Load module settings 
[INFO] [14:01:51.137] Language is forced to java 
[INFO] [14:01:51.144] Loading rules... 
[INFO] [14:01:52.704] Loading rules done: 1560 ms 
[INFO] [14:01:52.749] Configure Maven plugins 
[INFO] [14:01:53.031] Compare to previous analysis (2016-06-09) 
[INFO] [14:01:53.053] Compare over 30 days (2016-05-10, analysis of 2016-06-01 14:22:45.0) 
[INFO] [14:01:53.057] No quality gate is configured. 
[INFO] [14:01:54.287] Base dir: E:\jenkins-slave\workspace\workspace\Mediation-Sonar-Test-Alex 
[INFO] [14:01:54.288] Working dir: E:\jenkins-slave\workspace\workspace\Mediation-Sonar-Test-Alex\target\sonar 
[INFO] [14:01:54.292] Source paths: pom.xml 
[INFO] [14:01:54.308] Source encoding: windows-1252, default locale: en_US 
[INFO] [14:01:54.309] Index files 
[INFO] [14:01:54.366] 0 files indexed 
[INFO] [14:01:54.368] Quality profile for java: Sonar way 
[INFO] [14:01:54.416] Sensor QProfileSensor... 
[INFO] [14:01:54.446] Sensor QProfileSensor done: 30 ms 
[INFO] [14:01:54.447] Sensor InitialOpenIssuesSensor... 
[INFO] [14:01:54.623] Sensor InitialOpenIssuesSensor done: 176 ms 
[INFO] [14:01:54.624] Sensor ProjectLinksSensor... 
[INFO] [14:01:54.677] Sensor ProjectLinksSensor done: 53 ms 
[INFO] [14:01:54.682] Sensor VersionEventsSensor... 
[INFO] [14:01:54.733] Sensor VersionEventsSensor done: 51 ms 
[INFO] [14:01:54.734] Sensor FileHashSensor... 
[INFO] [14:01:54.735] Sensor FileHashSensor done: 1 ms 
[INFO] [14:01:54.735] Sensor Maven dependencies... 
[INFO] [14:01:55.009] Sensor Maven dependencies done: 273 ms 
[INFO] [14:01:55.013] Sensor CPD Sensor (wrapped)... 
[INFO] [14:01:55.017] JavaCpdEngine is used for java 
[INFO] [14:01:55.018] Sensor CPD Sensor (wrapped) done: 6 ms 
[INFO] [14:01:55.464] Execute decorators... 
[INFO] [14:01:55.955] Store results in database 
[INFO] [14:01:56.238] ANALYSIS SUCCESSFUL, you can browse *** 
[INFO] [14:01:56.329] Executing post-job class org.sonar.plugins.dbcleaner.ProjectPurgePostJob 
[INFO] [14:01:56.348] -> Keep one snapshot per day between 2016-05-12 and 2016-06-08 
[INFO] [14:01:56.354] -> Keep one snapshot per week between 2015-06-11 and 2016-05-12 
[INFO] [14:01:56.358] -> Keep one snapshot per month between 2011-06-16 and 2015-06-11 
[INFO] [14:01:56.365] -> Delete data prior to: 2011-06-16 
[INFO] [14:01:56.375] -> Clean MEDIATION-DEV1_SMED-Apporteur [id=4094] 
[INFO] [14:01:56.387] <- Delete aborted builds 
[INFO] [14:01:56.491] <- Clean snapshot 7289 
[INFO] [14:01:56.646] Executing post-job class org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob 
[INFO] [14:01:56.647] Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 18.157 s 
[INFO] Finished at: 2016-06-09T14:01:56+02:00 
[INFO] Final Memory: 23M/428M 
[INFO] ------------------------------------------------------------------------ 

当我浏览指定的地址,(配置的)仪表板中不会显示任何结果。

你有什么想法吗?

问候。

Thomas

回答

1

SonarQube是一个源代码分析器。根据定义,它所做的一切(创建度量标准,问题......)都必须附加到源文件。因此,如果您没有项目的来源(在日志中可见:0 files indexed),那么这在项目仪表板中没有任何东西是正常的。

+0

因此,Sonar绝对没有办法提供外部XML Junit报告?我真的没有访问源代码 –

+0

没有。如果你无法访问源代码,我甚至不明白你为什么试图使用SonarQube。 –

+0

谢谢,我现在知道该怎么做。 –

相关问题