1

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"
    }
}
Ryan M
  • 688
  • 6
  • 12
  • Sincere apologies for shamelessly hijacking your question, but as you're clearly using the SonarQube plugin, I wonder if I can persuade you to look at my question, about how to obtain it? (http://stackoverflow.com/questions/36550576/where-is-the-new-sonarqube-gradle-plugin) – DaveyDaveDave Apr 11 '16 at 13:48
  • 1
    Done, on both questions. Good luck! I just hope someone who can answer this one eventually comes along. – Ryan M Apr 11 '16 at 20:30
  • What is artifactory? Is that a local repo? – durron597 Apr 11 '16 at 21:42
  • Artifactory is a local package repository. It's set to mirror/proxy Maven Central and Jcenter. https://www.jfrog.com/artifactory/ – Ryan M Apr 11 '16 at 22:23

1 Answers1

1

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.

Community
  • 1
  • 1
durron597
  • 31,968
  • 17
  • 99
  • 158
  • The problem was in the compiled Java, not the Gradle JVM. Once I added compile 'org.joda:joda-convert:1.8' after the joda-time dependency, the error went away. See the duplicate for the details. – Ryan M Apr 11 '16 at 22:47