How to use wild card in 'sonar.libraries'

1,068 views
Skip to first unread message

kaorih...@gmail.com

unread,
Sep 29, 2015, 9:42:19 PM9/29/15
to SonarQube
Could I ask one question about the 'sonar.libraries' on this page ?
http://docs.sonarqube.org/display/PLUG/Java+Plugin+and+Bytecode

There is a description of the effect that wild card is available.
However,error occurs when we analyze some sources by using the following
settings.
I'd like to use a wild card without an error.

Incidentally, my server is to use only JDK6, you must use the following
version.
    SonarQube 4.5.2
    Java 2.4

<Jar file storage location>
/mnt/vol03/jenkins/jobs/myjob/branches/develop/workspace/projectname/

<Property settings>
sonar.libraries=cache/**/*.jar

<error logs>
-------------------------------------------------------------------------------------
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: No files nor directories
matching 'cache/**/*.jar' in directory
/mnt/vol03/jenkins/jobs/myjob/branches/develop/workspace/projectname
        at
org.sonar.batch.scan.ProjectReactorBuilder.validateDirectories(ProjectReactorBuilder.java:302)
        at
org.sonar.batch.scan.ProjectReactorBuilder.loadChildProject(ProjectReactorBuilder.java:217)
        at
org.sonar.batch.scan.ProjectReactorBuilder.defineChildren(ProjectReactorBuilder.java:192)
        at
org.sonar.batch.scan.ProjectReactorBuilder.execute(ProjectReactorBuilder.java:116)
        at
org.sonar.batch.scan.ProjectScanContainer.projectBootstrap(ProjectScanContainer.java:120)
        at
org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:98)
        at
org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:91)
        at
org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
        at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:64)
        at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:51)
        at
org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:125)
        at
org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
        at
org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
        at
org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:173)
        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(NativeMethodAccessorImpl.java:57)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at
org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
        ... 9 more

-------------------------------------------------------------------------------------

David Racodon

unread,
Sep 30, 2015, 3:28:14 AM9/30/15
to kaori hattanda, SonarQube
Hi,

It means that the 'cache' directory does not exist or that it (or any of its subfolders) does not contain any .jar file.
Are you sure that the 'cache' directory is at the root of your project? What if you try **/cache/**/*.jar

Regards,

David RACODON
Freelance QA Consultant

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/742ab4d8-949b-45f0-acb3-b06e43ea39d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Racodon

unread,
Sep 30, 2015, 3:30:13 AM9/30/15
to kaori hattanda, SonarQube
And you should upgrade to the latest version of the Java plugin (3.5, http://docs.sonarqube.org/display/PLUG/Java+Plugin) as they've been improvements around this feature in latest versions.

David RACODON
Freelance QA Consultant

kaorih...@gmail.com

unread,
Oct 1, 2015, 10:05:52 AM10/1/15
to SonarQube, kaorih...@gmail.com

<Jar file storage location>
/mnt/vol03/jenkins/jobs/myjob/branches/develop/workspace/projectname/

This it was wrong

<Jar file storage location>
/mnt/vol03/jenkins/jobs/myjob/branches/develop/workspace/projectname/cache/jarname1/jarname1.jar
/mnt/vol03/jenkins/jobs/myjob/branches/develop/workspace/projectname/cache/jarname2/jarname2.jar
/mnt/vol03/jenkins/jobs/myjob/branches/develop/workspace/projectname/cache/jarname3/jarname3.jar

I've tried '**/cache/**/*.jar'.
However, the result was the same.

Also, I'd like to know the impact of this problem.
Specifically, do you have affect in which rules?

Nicolas Peru

unread,
Oct 7, 2015, 5:49:07 AM10/7/15
to kaorih...@gmail.com, SonarQube
Hi, 

As stated by David, please use latest version of the java plugin.

Next, which rules are impacted : nearly all... in fact for semantic analysis to be precise and complete you need to provide external dependencies of your project so the analyzer can access the .class files of those dependencies. 

Some rules might not require semantic but a lot of them are relying on it now and so you will get less accurate results if you don't provide those properties properly.

Cheers,


Nicolas PERU | SonarSource
Senior Developer
http://sonarsource.com


--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages