1

Why do I get this error:

Class not found: org.joda.convert.ToString

None of my code uses this class (maven-based sonar analysis), and it doesn't seem to affect the analysis. However, I get worried whenever there are "[ERROR]" logs in the output. My exact command is:

mvn org.codehaus.mojo:sonar-maven-plugin:2.6:sonar

I switched to this because someone in another related answer suggested this...

Dyrandz Famador
  • 4,499
  • 5
  • 25
  • 40

1 Answers1

1

This error message is logged by the analyzer whenever it tries to complete a symbol during semantic analysis and cannot find a .class file.

This will happen wether your classes are using this class directly or transitively (via a dependence, or a dependence of a dependence, etc.). This is arguably an error per say in all cases but this is an important information for users to know because lacking some classes can lead to incomplete results (some issues might not be raised because symbols won't be resolved).

benzonico
  • 10,635
  • 5
  • 42
  • 50
  • You can also read [this](https://groups.google.com/forum/#!topic/sonarqube/Yh2VgAM22B4) topic on SonarQube google group. – agabrys Feb 02 '16 at 21:03
  • 1
    Well, okay, this answers the question, but it does not help at all. It is a **bug** in the Sonar Analyzer which is unable to include **optional** Maven dependencies. joda-time has an optional dependency to joda-convert, and as **many** people use this library, many have this problem (our company included). – Florian Albrecht Feb 05 '16 at 11:03
  • Given what is an optional dependency http://stackoverflow.com/questions/5860426/optional-dependency-with-scope-provided-in-maven I would not qualify this behavior as a bug. However I agree that reporting missing class files is rather confusing right now and should most likely be improved. – benzonico Feb 05 '16 at 12:08