2

Im trying to run a sonar analysis on a Jenkins Job. Im using ant so im using Sonar Runner and sonar.properties in the projects. Im configuring the the binaries to

sonar.binaries=build/ant/classes

After a successfull build Sonar starts and is running a while. But i get a lot of warnings during bytecode analysis.

Im getting WARN XX - Class 'XX' is not accessible through the ClassLoader.

for every class...

I dont really know why classes are all there?

Hannes
  • 442
  • 1
  • 6
  • 23

2 Answers2

5

These are warnings issued by Findbugs, which requires access to source, compile binaries and 3rd party libraries.

To resolve these warnings you need to include an additional sonar.libraries property, populated with the 3rd party jars your code depends upon (See Analaysis Parameters documentation)

Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • you mean for every class which is not accessible i need sonar.libraries? but isnt there another message like "The following classes where missing " which show the missing library classes? For me it looks like he can't access most of the classes he should analyze... – Hannes Jan 07 '13 at 15:40
  • @Hannes I think there may actually be two findbugs error messages. I can't remember the detail. In any case the purpose of the "sonar.libraries" property is to correctly populate the java path used by findbugs. BTW it's worth nothing Sonar will use a property or an ANT path, just make sure its called "sonar.libraries". Using the Java runner makes this more difficult.... – Mark O'Connor Jan 07 '13 at 17:32
  • @Hannes Did you solve this issue? I'm having the same issue with maven and jenkins. – tholu May 04 '16 at 15:30
0

I actually had the same problem, but that was because of an issue with the maven caches.

I had run mvn clean install in the directory on my local machine, but was running sonar on the directory on a virtual box. This resulted in classes not being found.

wilson
  • 163
  • 1
  • 2
  • 12
  • Can you extend what you did to fix the problem? Run mvn clean on the sonar instance? – tholu May 04 '16 at 15:31
  • hopefully this helps you out @tholu2 http://stackoverflow.com/questions/31528033/sonarqube-class-not-found-during-main-ast-scan – wilson May 07 '16 at 01:38
  • Thanks, my problem was simple, had to add a pre-build step where I would do an `mvn compile`. – tholu May 09 '16 at 10:56