2
votes

I am using maven integration of sonar. My server is set up and running properly, and i am able to see the report in the browser, as well as violations in Eclipse.
My problem is i want to run the local analysis in Eclipse so that i can refactor the violations and see the change dynamically is eclipse itself.
But the local analysis fails and shows the below mentioned trace.

Runner configuration file: NONE<br>
Project configuration file: NONE<br>
Runner version: 2.0<br>
Java version: 1.6.0_41, vendor: Sun Microsystems Inc.<br>
OS name: "Windows 7", version: "6.1", arch: "amd64"<br>
Default locale: "en_US", source code encoding: "Cp1252"<br>
Server: [http://localhost:9000]<br>
Work directory: C:\dev\UPS Eclipse<br>
workspace\ips\.metadata\.plugins\org.eclipse.core.resources\.projects\ips-client\org.sonar.ide.eclipse.core<br>
Total time: 8.058s<br>
Exception in thread "main" org.sonar.runner.RunnerException: org.sonar.runner.RunnerException: No files matching pattern "dhbcore.jar" in directory "C:\Users\sg0213152\.m2\repository\com\ibm\com.ibm.dhbcore\7.5.0.0"<br>
    at org.sonar.runner.Runner.delegateExecution(Runner.java:288)<br>
    at org.sonar.runner.Runner.execute(Runner.java:151)<br>
    at org.sonar.runner.Main.execute(Main.java:84)<br>
    at org.sonar.runner.Main.main(Main.java:56)<br>
Caused by: org.sonar.runner.RunnerException: No files matching pattern "dhbcore.jar" in directory "C:\Users\sg0213152\.m2\repository\com\ibm\com.ibm.dhbcore\7.5.0.0"<br>
    at org.sonar.runner.internal.batch.SonarProjectBuilder.getLibraries(SonarProjectBuilder.java:440)<br>
    at org.sonar.runner.internal.batch.SonarProjectBuilder.cleanAndCheckModuleProperties(SonarProjectBuilder.java:327)<br>
    at org.sonar.runner.internal.batch.SonarProjectBuilder.cleanAndCheckProjectDefinitions(SonarProjectBuilder.java:305)<br>
    at org.sonar.runner.internal.batch.SonarProjectBuilder.generateProjectDefinition(SonarProjectBuilder.java:123)<br>
    at org.sonar.runner.internal.batch.Launcher.execute(Launcher.java:58)<br>
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br>
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br>
    at java.lang.reflect.Method.invoke(Method.java:597)<br>
    at org.sonar.runner.Runner.delegateExecution(Runner.java:285)<br>
    ... 3 more<br>
Final Memory: 1M/120M<br>

P.S: I have the jar named 'com.ibm.dhbcore-7.5.0.0' already present in the specified location. Also, if i rename this file to the exact string that it is searching for, it then shows that some other jar is missing. I tried doing that for about 10-15 jars till i finally gave up.

Versions:
Eclipse: Juno
Sonar: 3.4.1
Sonar Java Analyzer (plugin for eclipse): 3.0

Solution - Upgraded SonarQube to the latest version
Upgraded SonarQube to 3.7.2
Upgraded Sonar Java Analyzer to 3.2.0

1
Which version of Sonar Eclipse are you using? - Fabrice - SonarSource Team
Fabrice, I have edited my post and updated it with the version details. - Pankaj
OK, thanks. GTW, how Eclipse reference a missing file? Are you sure you updated your project configuration with Maven Eclipse plugin (m2eclipse)? - Fabrice - SonarSource Team
Well, I am not sure that i understand you fully. I installed the latest maven plugin for eclipse. Do i need to update my pom.xml with this plugin information? - Pankaj
If you're using m2e in Eclipse, your project classpath should never have referenced an unexisting JAR file => Maven normally takes care to tell Eclipse which JARs are in the classpath, and those JARs necessarily exist on your file system. - Fabrice - SonarSource Team

1 Answers

1
votes

Please check your project settings in Eclipse, especially "Java Build Path" => "Libraries". You should have invalid entries like "C:\Users\sg0213152.m2\repository\com\ibm\com.ibm.dhbcore\7.5.0.0\dhbcore.jar"

You can also try to use a more recent version of SonarQube Eclipse (but that may force you to upgrade also your SonarQube server). We have added existence check before adding file in sonar.libraries to protect against invalid Eclipse classpath.