Domanda

I am using local sonar 3.5.1 for my code statistics for my java maven project using mvn sonar:sonar. But now i want use sonar-runner for the same. So i installed sonar-runner 2.3 and set in my Ubuntu $PATH variable and now able to test using sonar-runner -h. I added sonar-project.properties in the root directory of the project. and content of this file is like

# required metadata
sonar.projectKey=netsgear:analytix
sonar.projectName=analytix
sonar.projectVersion=1.0

# optional description
sonar.projectDescription=application analysis

# path to source directories (required)
sonar.sources=srcDir1,srcDir2

# The value of the property must be the key of the language.
sonar.language=java

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

# Additional parameters
sonar.my.property=value

sonar is running on localhost://9000. But execute I "sonar-runner" from my project directory it is throwing exception, output of sonar-runner -X is

INFO: SonarQube Server 3.5.1
13:06:50.497 ERROR rojectReactorBuilder - Invalid value of sonar.sources for 
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 0.483s
Final Memory: 3M/119M
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:90)
    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:41)
Caused by: java.lang.IllegalStateException: The folder 'srcDir1' does not exist for  (base directory = /home/workspace/core)
    at org.sonar.runner.batch.ProjectReactorBuilder.checkExistenceOfDirectories(ProjectReactorBuilder.java:475)
    at org.sonar.runner.batch.ProjectReactorBuilder.cleanAndCheckModuleProperties(ProjectReactorBuilder.java:370)
    at org.sonar.runner.batch.ProjectReactorBuilder.cleanAndCheckProjectDefinitions(ProjectReactorBuilder.java:353)
    at org.sonar.runner.batch.ProjectReactorBuilder.build(ProjectReactorBuilder.java:130)
    at org.sonar.runner.batch.IsolatedLauncher.createBatch(IsolatedLauncher.java:60)
    at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:45)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
    ... 9 more

May I know the reson

È stato utile?

Soluzione

I would guess that you have an error in your config.

# path to source directories (required)
sonar.sources=srcDir1,srcDir2

Are srcDir1 and srcDir2 really the folders where you have your source files? It seems you copied the config from some tutorial and forget to insert the correct folder names.

Also you can remove the following lines, because I don't think you have any custom sonar parameters named like this.

# Additional parameters
sonar.my.property=value
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top