2016-06-23 7 views
0

아주 기본적인 C++ 프로젝트에서 SonarQube를 사용하려고합니다. 나는 CppUnit을 사용하여 xml 보고서를 생성하는 테스트를 수행한다.
SonarQube C++ 커뮤니티 플러그인을 사용하지만 SonarQube에서 테스트 결과를 보여주지 못했습니다.Sonarqube가 내 cppunit 보고서를 볼 수 없습니다.

은 여기 내 sonar-project.properties가 나는 XSLT 변환 CppUnit을 보고서를 읽을 수 SonarQube을 위해 필요했던 인터넷에서 발견

# Required metadata 
sonar.projectKey=test 
sonar.projectName=C++ Project Test 
sonar.projectVersion=1.0 

# Comma-separated paths to directories with sources (required) 
sonar.sources=./ 

# Language 
sonar.language=c++ 

# Encoding of the source files 
sonar.sourceEncoding=UTF-8 

# Path to the directory containing the CPPUnit reports 

sonar.cxx.xunit.xsltURL=report/cppunit/cppunit-1.x-to-junit-1.0.xsl 
sonar.cxx.xunit.reportPath=report/cppunit/cppunit-report.xml 

파일입니다.
내 프로젝트 폴더에서 sonar-runner -X를 실행하여 분석을 시작합니다.
- xslt 변환없이 사용하려고하면 아무런 오류가 없지만 SonarQube 웹 인터페이스의 테스트에 대해 언급하지 않았습니다 (실행되지 않은 것처럼).
- 나는 XSLT 변환을 사용할 때 나는이 오류가 :

Transforming the report using xslt 'report/cppunit/cppunit-1.x-to-junit-1.0.xsl' 
10:21:36.793 DEBUG - Transforming: try to access external XSLT via URL 
10:21:36.794 ERROR - Cannot feed the data into SonarQube, details: 'java.net.MalformedURLException: no protocol: report/cppunit/cppunit-1.x-to-junit-1.0.xsl' 
INFO: ------------------------------------------------------------------------ 
INFO: EXECUTION FAILURE 
INFO: ------------------------------------------------------------------------ 
Total time: 7.589s 
Final Memory: 21M/292M 
INFO: ------------------------------------------------------------------------ 
ERROR: Error during Sonar runner execution 
org.sonar.runner.impl.RunnerException: Unable to execute Sonar 
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91) 
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) 
at java.security.AccessController.doPrivileged(Native Method) 
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) 
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) 
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) 
at org.sonar.runner.api.Runner.execute(Runner.java:100) 
at org.sonar.runner.Main.executeTask(Main.java:70) 
at org.sonar.runner.Main.execute(Main.java:59) 
at org.sonar.runner.Main.main(Main.java:53) 
Caused by: java.lang.IllegalStateException: Cannot feed the data into SonarQube, details: 'java.net.MalformedURLException: no protocol: report/cppunit/cppunit-1.x-to-junit-1.0.xsl' 
at org.sonar.plugins.cxx.tests.xunit.CxxXunitSensor.analyse(CxxXunitSensor.java:159) 
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58) 
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50) 
at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83) 
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192) 
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) 
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) 
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241) 
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236) 
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226) 
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) 
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) 
at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47) 
at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86) 
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) 
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) 
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106) 
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119) 
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:79) 
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:498) 
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87) 
... 9 more 
Caused by: java.net.MalformedURLException: no protocol: report/cppunit/cppunit-1.x-to-junit-1.0.xsl 
at java.net.URL.<init>(URL.java:593) 
at java.net.URL.<init>(URL.java:490) 
at java.net.URL.<init>(URL.java:439) 
at org.sonar.plugins.cxx.tests.xunit.CxxXunitSensor.transformReport(CxxXunitSensor.java:265) 
at org.sonar.plugins.cxx.tests.xunit.CxxXunitSensor.analyse(CxxXunitSensor.java:135) 
... 33 more 

누구가이 문제를 해결하는 방법에 대한 아이디어가 있습니까? 또는 SonarQube에서 CppUnit 보고서를 사용하는 방법을 보여주는 자습서 또는 다른 내용은 무엇입니까? 몇 시간 동안 수색했지만 아무 것도 찾지 못했습니다.

답변

0

내 문제가 해결되었습니다. cppunit xml 파일이있는 곳에서 xslt 변환 파일의 경로가 시작되는 것처럼 보입니다.

sonar.cxx.xunit.xsltURL=cppunit-1.x-to-junit-1.0.xsl 
이에 의해

sonar.cxx.xunit.xsltURL=report/cppunit/cppunit-1.x-to-junit-1.0.xsl 

: 내 경우

는,이 대체했다
관련 문제