user1720124
user1720124

Reputation: 117

Sonar Analysis throwing squid error

Hi i am trying to analyse my code base which is in java using sonar tool, we use ANT as our build tool but when i run sonar-runner from the source directory i get

12:36:09.815 ERROR heckstyleSquidBridge - Squid Error occurs when analysing :/root/.jenkins/jobs/Example_4.9/workspace/dev/statsvc/src/java/com/sample/sim/statisticsvc/StatisticsServiceImpl.java
org.sonar.squid.api.AnalysisException: The source directory does not correspond to the package declaration com.sample.sim.statisticsvc

What should i do in this case? Do i need to run sonar in the light mode if so how do i achieve it?

Upvotes: 2

Views: 3998

Answers (3)

gdfbarbosa
gdfbarbosa

Reputation: 835

It just happened that I was using a different version of maven sonar plugin and my sonar qube version was different. Tried to use the same version and it worked for me. (3.2)

Upvotes: 0

nostromo
nostromo

Reputation: 75

I'm having the same error in a maven build that used to work. I guess the cause is that we renamed the artifacts and this is somehow driving sonar crazy, but I really don't know. The source dir is set up automatically by the maven plugin, the compilation is allright. The error just don't make sense... We are stopping using Sonar because of these errors, and I can't find a workaround.

Upvotes: 0

The problem comes from the fact that you haven't specified a correct location for the source directory.

This source directory should somehow point to "/root/.jenkins/jobs/Example_4.9/workspace/dev/statsvc/". With the Sonar Jenkins Plugin, this means that you should specify "sonar.sources" to something like "dev/statsvc".

Upvotes: 4

Related Questions