简体   繁体   中英

Jenkins vs SonarQube: issue connected with Sonar Runner and sonar.sources parameter

I received the following information when i was try to build Jenkins C# project:

[Project_Name] $ O:\sonar-runner-2.4\bin\sonar-runner.bat -e -Dsonar.jdbc.url=jdbc:jtds:sqlserver://database.net/sonar;SelectMethod=Cursor ******** ******** -Dsonar.host.url=http://sonar.net:9000 ******** ******** -Dsonar.projectBaseDir=o:\jenkins\workspace\Project_Name -Dsonar.jdbc.password=******* -Dsonar.jdbc.username=sonar
O:/sonar-runner-2.4/
SonarQube Runner 2.4
Java 1.8.0_45 Oracle Corporation (64-bit)
Windows Server 2008 R2 6.1 amd64
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: O:\sonar-runner-2.4\conf\sonar-runner.properties
INFO: Project configuration file: o:\jenkins\workspace\Project_Name\sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Work directory: o:\jenkins\workspace\Project_Name\.sonar
INFO: SonarQube Server 5.1
15:44:26.946 INFO  - Load global repositories
15:44:27.433 INFO  - Load global repositories (done) | time=490ms
15:44:27.438 INFO  - Server id: ************
15:44:27.445 INFO  - User cache: C:\Users\19231\.sonar\cache
15:44:27.465 INFO  - Install plugins
15:44:27.787 INFO  - Install JDBC driver
15:44:27.797 INFO  - Create JDBC datasource for jdbc:jtds:sqlserver://sonar.net/sonar;SelectMethod=Cursor
15:44:29.808 INFO  - Initializing Hibernate
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 6.230s
Final Memory: 15M/451M
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: You must define the following mandatory properties for 'my:AllocationAssistant': sonar.sources
at     org.sonar.batch.scan.ProjectReactorBuilder.checkMandatoryProperties(ProjectReactorBuilder.java:315)
at org.sonar.batch.scan.ProjectReactorBuilder.defineRootProject(ProjectReactorBuilder.java:157)
at org.sonar.batch.scan.ProjectReactorBuilder.execute(ProjectReactorBuilder.java:116)
at org.sonar.batch.scan.ProjectScanContainer.projectBootstrap(ProjectScanContainer.java:110)
at org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:86)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:90)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:135)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:158)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
ERROR: 
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure
Finished: FAILURE

sonar-project.properties file looks like:

sonar.projectKey=my:AllocationAssistant
sonar.projectName=AllocationAssistant
sonar.projectVersion=prd
sonar.source=.
sonar.language=cs
sonar.dotnet.visualstudio.solution.file=AllocationAssistant.sln
sonar.dotnet.excludeGeneratedCode=true
sonar.dotnet.4.0.sdk.directory=C:/Windows/Microsoft.NET/Framework/v4.0.30319
sonar.dotnet.version=4.0

Anybody have an idea what could be wrong with sonar-project.properties? I assume that there could be problem. Sonar-project.properties is in the same folder where .sln is located.

I will be grateful for your opinion and help.

There is a typo in your sonar-project.properties configuration file. 'sonar.source' instead of 'sonar.sources'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM