Search code examples
javagradlesonarqube5.3

SonarQube Gradle Plugin warnings: "Class not found: org.joda.convert"


While running the SonarQube Gradle plugin on our project, during the Java Main Files AST scan, we're getting a number of warnings about joda-convert:

[WARN] [org.sonarqube.gradle.SonarQubeTask] Class not found: org.joda.convert.FromString [WARN] [org.sonarqube.gradle.SonarQubeTask] Class not found: org.joda.convert.ToString

I've tried several ways of pulling in org.joda:joda-convert:1.8 and none of them have solved the problem. How can we figure out why this dependency is not being found?

Note: we're using Java JDK 1.8, Gradle 2.11, and SonarQube 5.3.

EDIT: this is the relevant snippet from build.gradle. I've tried joda-convert versions 1.7, 1.8, and 1.8.1 with no success.

buildscript {
    repositories {
        maven {
            url "http://artifactory:7980/artifactory/libs-release"
        }
    }
    dependencies {
        classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:1.2"
        classpath 'org.joda:joda-convert:1.7'
    }
}    
apply plugin: 'org.sonarqube'
sonarqube {
    properties {
        property "sonar.projectName", "Project"
        property "sonar.projectKey", "local.project"
    }
}

Solution

  • Joda time has two packages, joda-time and Joda-Convert. The annotations you are not able to find are in the Joda-Convert package, not [joda-time].

    These errors are just low-severity warnings and should not actually affect your issues with using joda-time.

    However, upon a second read-through of your question, it looks like you've already realized this and have included the dependency in your .gradle file. This suggests to me that most likely it's a configuration syntax issue with your .gradle file. If the first paragraph doesn't solve your issue, then please edit your question to include a .gradle snippet about how you've tried to include this dependency to fix the problem. Please note that Joda-time has Joda-convert as an optional dependency in its Maven POM and that could be confusing Gradle.

    Also please include the versions of both joda-time and joda-convert you are attempting to use when you edit your question.